Even though the ternary operator (and/or some if() functions) work great in the evaluator, I think having a null coalescing operator would help for readability.
I must admit that I think it would only help if it would also count empty strings as 'null' though.
Any thoughts on this?
The evaluator doesn't have the concept of null so I'm not sure how useful this would be. What's an example of how you'd use it?
I understand that null is difficult, which is why I would like it to recognize empty strings (or maybe also 0?):
x = regex(string, test1, "\1", "e");
y = regex(string, test2, "\1", "e");
return x ?? y // Return either x or y, depending on x being empty
I think it just does not exist in the jscript version Windows is providing and Opus is relying upon.
It appeared in more recent version of javascript.
Thanks, that makes sense. We'll add this in the next beta. It'll use a "logical not" test, so x ?? y will be functionally equivalent to if (!x) { x = y; }. That will mean empty strings, the value 0 and the value false.
I am looking forward to this.
I have no particular use for it at this time, but I have a few Regular Expressions that rely on Null Capture Groups.
Thanks, I appreciate it!
Works in 13.17.1