02-16-2021 02:29 PM
I have:
Locals.TestBool = (Locals.Value != (1||2) ? True: False)
When the value is 1, it returns False. But if the value is 2, it returns True. Does that not work as I expect? Not a traditional OR? Am I missing something? Is that not actually saying If Locals.Value Does NOT Equal 1 OR 2, then True? Why does it return false for only 1?
Solved! Go to Solution.
02-16-2021 07:26 PM
|| causes a Boolean OR. 1||2 will result in a TRUE. Now that TRUE has to be converted into a numeric to compare to your number, which will be a 1. So 2 does not equal 1, therefore your result is TRUE.
What you really need here is:
Locals.TestBool = (Locals.Value != 1) && (Locals.Value != 2)
With this setup one of the intermediate values will be a FALSE if Value is a 1 or a 2. You need to then AND those values to get the result you want.
02-17-2021 07:15 AM
Ahhhh.... Thank you! This feels like a newby mistake. Much appreciated.