Null coalescing operator| View in Tracker
Status/Resolution/Reason: Needs Review//Investigate
Failure Type: Others
Found In Build/Fixed In Build: /
Priority/Frequency: Normal /
Locale/System: / Platforms All
Vote Count: 3
Catch undefined values and return a default. Suggested operator syntax: ?? (double question mark) A new operator that works as the Elvis operator (?:) originally worked (see CF-3589888) before it was rendered useless (see CF-4028653) for null coalescence by making it function as a binary equivalent to the ternary conditional operator (? :) due to its equating null/undefined variables with variables defined with falsey values. Specifically, a defined variable with falsy values MUST NOT return the default, or right expression, rather it should return the value of the variable as it is defined: myVar1 = 0; test1 = myVar1 ?? 1; // should result in test1 = 0 myVar2 = false; test2 = myVar2 ?? true; // should result in test2 = false myVar3 = "no"; test3 = myVar3 ?? "yes"; // should result in test3 = "no" test4 = myUndefinedVar ?? "default"; // should result in test4 = "default"