Adding the ?. null verification

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 14:19:28 PDT 2014


On 2014-06-19 16:37, Craig Dillabaugh wrote:

> Is this any better than?
>
> if(!a) a = b;

I would say it's about the same as "a ?? b" is better than "a ? a : b". 
It's get better since you can use it directly in a return statement:

void a ()
{
     return a ??= new Object;
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list