I have this loop here that alternates a boolean.
Here is what I mean:
bool switch = false;
while(true) {
switch = !switch;
std::cout << switch << std::endl;
}
Every time this code loops, the boolean named switch will alternate between true and false.
Something like:
bool switch = false;
while(true) {
std::cout << !switch << std::endl;
}
There is really nothing wrong with this but I would like a one-line solution.
Of course, that doesn't work but something similar to that.