Hacker News new | ask | show | jobs
by a_lieb 2498 days ago
Due to exactly this issue, an increasing number of languages have an operator just for "if exists and not null": the null coalescing operator[0].

What "exists" means depends on the language; it can be as loose as checking if the variable has ever been set (PHP), but generally has nothing to do with truthiness/falsiness status.

[0] https://en.wikipedia.org/wiki/Null_coalescing_operator