03-10-2016 09:50 AM
Shouldn't this work? I get a status error:unexpected token at the 2nd =:
True ? Locals.x = 1 : Locals.x = 2
Stephen
Solved! Go to Solution.
03-10-2016 10:11 AM
You need parenthesis: True ? (Locals.x = 1) : (Locals.x = 2) Because it takes the first expression available. In this case Locals.x was the first expression after the : This means that it doesn't know how to evaluate the rest of the expression.
A better way to do this: Locals.x = (True ? 1 : 2) Of course I understand your scenario might be slightly different and you were just using this as an example. But I always try to move as much as I can outside of the conditional statement.
Hope this helps,
03-10-2016 11:04 AM
Thanks, makes sense. Is multiple assignment possible?
True ? (Locals.x = 3, Locals.y = 4) : (Locals.x = 1, Locals.y = 5)
03-10-2016 11:08 AM
Yes you can.