Open
Description
Describe the suggested feature
Currently x ?? 0
is a syntax error. It would be handy if this meant the nullish coalescing operator denoted by ??
in JavaScript. For example, one could then do object lookup with a fallback : {foo: 7, bar: 3}["baz"] ?? 0
.
Current workaround
nullish(x, y) = (x == null or x == undefined) ? y : x; nullish(null, 0)
I am not aware of a short way to test for null or undefined unlike x == null
in JavaScript which is true if x is either null or undefined; in mathjs expression language it is true when x is null and false when x is undefined.