I read some articles from Stackoverflow.com, especially:
What's the most concise way to get the inverse of a Java boolean value?
Easiest way to flip a boolean value?
What's happens if I have three boolean variables ? I want to assign a true/false value using single line.
For example, test1
and test3
must be true and test2
must be false.
I used
test1 = test2 ^= test3 = true; //true, false, true
or
test1 = test3 ^= test2 ^= true;
But it not good. The logic is not good.
I know that my question is simple but I have 6-7 boolean variables and I want to assign values using single line, if is possible.
It is possible ?