Inverting a Bool
Posted: Sun May 24, 2020 11:24 pm
Hi,
In a program I have to invert a Bool variable.
I did not want to use If A = 0 then 1 else 0, but just toggle the value:
In other C dialects it would be: A = !A ( where ! means NOT)
Since there does not seem to be a "!" in Flowcode, I used NOT
So I thought A = NOT A would do the trick, but then the varaible changes from 0 to 1, but never goes back to 0 again.
The method A = A XOR 1 works fine
Can somebody explain what happens when I use A = NOT A
In a program I have to invert a Bool variable.
I did not want to use If A = 0 then 1 else 0, but just toggle the value:
In other C dialects it would be: A = !A ( where ! means NOT)
Since there does not seem to be a "!" in Flowcode, I used NOT
So I thought A = NOT A would do the trick, but then the varaible changes from 0 to 1, but never goes back to 0 again.
The method A = A XOR 1 works fine
Can somebody explain what happens when I use A = NOT A