Adding the ?. null verification

Craig Dillabaugh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 19 07:37:49 PDT 2014


On Thursday, 19 June 2014 at 10:10:30 UTC, Jacob Carlborg wrote:
> On 2014-06-18 17:46, Kapps wrote:
>
>> C# is getting the same syntax, and I remember there being some
>> discussion about it here. It's somewhat useful I suppose, 
>> though I think
>> it's made significantly more useful in C# with 'a ?? b' (a if 
>> a is not
>> null, else b).
>
> And "a ??= b", assigne "b" to "a", only if "a" is null.

Is this any better than?

if(!a) a = b;


More information about the Digitalmars-d mailing list