Is there a shortcut to the following statement?
if(b!=null) a=b;
The best I can come up with is
a=b??a;
I want to assign b
to a
only if b
is not null
, otherwise I want to leave a
unchanged.
The statement a??=b;
is the opposite of what I want, equivalent to
if(a==null) a=b;