Is there an “opposite” to the null coalescing operator? (…in any language?)

There’s the null-safe dereferencing operator (?.) in Groovy… I think that’s what you’re after.

(It’s also called the safe navigation operator.)

For example:

homePostcode = person?.homeAddress?.postcode

This will give null if person, person.homeAddress or person.homeAddress.postcode is null.

(This is now available in C# 6.0 but not in earlier versions)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)