arrays: if(null == [ ])

simendsjo simendsjo at gmail.com
Mon May 14 04:55:16 PDT 2012


On Mon, 14 May 2012 13:51:40 +0200, deadalnix <deadalnix at gmail.com> wrote:

> Le 14/05/2012 12:49, Gor Gyolchanyan a écrit :
>> So, null arrays and empty arrays are always the same, except for an
>> empty string, which is a valid non-nill array of characters with length
>> 0, right?
>>
>
> If it is the current behavior, it deserve a WAT !

It is according to my tests.. It's quite a gotcha.
So check for .length or == "" or == [] if you need "null or empty" and use  
"is null" for null/[]


More information about the Digitalmars-d mailing list