Code:
Code: Select all
x5:=7,x3:=9
x1:=x1??x2??x3??x4??x5
OutputDebug(x1)
Code: Select all
x1:=x1??(x2?)
,x1:=x1??(x3?)
,x1:=x1??(x4?)
,x1:=x1??x5
Code: Select all
x5:=7,x3:=9
x1:=x1??x2??x3??x4??x5
OutputDebug(x1)
Code: Select all
x1:=x1??(x2?)
,x1:=x1??(x3?)
,x1:=x1??(x4?)
,x1:=x1??x5
Because expressions are not supported prior to ?? currently, from what has been described in the document. x1:=(x1??x2)??x3??x4??(x5?) will throw an error but x1:=x1??x2??x3??x4??(x5?) will not. The usage of x1:=x1??x2??x3??x4??x5 may be deleted as well in the future update if it's an undocumented usage. At that time, all of the codes on this usage have to be rewritten. So currently, you are not able to apply this usage to your codes with confidence. As similar things have happened to V2.0.4.Michaohneel wrote: ↑01 Aug 2023, 14:13I'm not sure what you think should be documented about this, that's just how operators work, isn't it?
All operators (with very few exceptions, which are documented) are evaluated from left to right. So just like 1 + 2 + 3 evaluates 1 + 2 first, and then + 3 to the result of that, a ?? b ?? c evaluates a ?? b first and then ?? c to the result of that.
Since x ?? y is just a shorthand for isSet(x) ? x : y, you may also look at it this way: a ?? b ?? c is equivalent to isSet(a) ? a : isSet(b) ? b : c. Now, in my opinion, that looks much more confusing and might actually be worth documenting. But even this case follows basic laws of infix operators (it just looks complicated because the ternary operator has, as the name suggests, three operands).
The only operators which are evaluated from right to left (it's called right-associativity) are the assignment operators (:= and its siblings) and the power operator (**). And both of which clearly say that in the documentation.
So, unless I'm missing something, I think this should either be documented more broadly, for all left-associative operators, or left as is.