6 ms·
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"
by a_lieb 7y 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 https://en.wikipedia.org/wiki/Null_coalescing_operator