null coalescing translates roughly to return x, unless it is null, in which case return y
return x, unless it is null, in which case return y
I often need return null if x is null, otherwise return x
return null if x is null, otherwise return x
If you've got a special kind of short-circuit boolean logic, you can do this (javascript example):
return x && x.y;
If x is null, then it won't evaluate x.y.
x
x.y