Hi,
Is there a short way to toggle a boolean?
With integers we can do operations like this:
int i = 4;
i *= 4; // equals 16
/* Which is equivalent to */
i = i * 4;
So is there also something for booleans (like the *=
operator for ints)?
In C++:
bool booleanWithAVeryLongName = true;
booleanWithAVeryLongName = !booleanWithAVeryLongName;
// Can it shorter?
booleanWithAVeryLongName !=; // Or something?
In Java:
boolean booleanWithAVeryLongName = true;
booleanWithAVeryLongName = !booleanWithAVeryLongName;
// Can it shorter?
booleanWithAVeryLongName !=; // Or something?