C# if-null-then-null expression

Something like Groovy’s null-safe dereferencing operator? string zipCode = customer?.Address?.ZipCode; I gather that the C# team has looked at this and found that it’s not as simple to design elegantly as one might expect… although I haven’t heard about the details of the problems. I don’t believe there’s any such thing in the language at …

Read more

PHP short-ternary (“Elvis”) operator vs null coalescing operator

When your first argument is null, they’re basically the same except that the null coalescing won’t output an E_NOTICE when you have an undefined variable. The PHP 7.0 migration docs has this to say: The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary …

Read more