Parameter is null by default. No value is given. Code says it is not null.

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 9 08:06:54 PDT 2015


On Thursday, 9 April 2015 at 15:04:47 UTC, Steven Schveighoffer 
wrote:
>> You can try if(string is null) - is instead of ==. Though 
>> usually in D,
>> I just if(string.length == 0) and treat empty and null the 
>> same way.
>
> This is likely not what you want, it's generally not important 
> where a string is located.

I think you were replying to the first sentence, but I recommend 
the second sentence: just always use `if(string.length)` and 
forget abotu where it is stored.


More information about the Digitalmars-d-learn mailing list