Is there a short way to switch logical?
With integers we can do the following operations:
int i = 4; i *= 4;
So, is there something for booleans (like the *= operator for ints)?
In C ++:
bool booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName;
In Java:
boolean booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName;
java c ++ boolean toggle
Martijn courteaux
source share