Toggle a boolean?

The manual was once more of no real use, so i have to ask here again.

Is there a simple way to toggle a boolean? Something like this?

var myFlag: boolean=true;

if (Keycode.K)
 myFlag=toggle;

Are you meaning something along the lines of the following?

booleanVar = booleanVar ? false : true;

or

booleanVar = !booleanVar;
4 Likes

myFlag = !myFlag;

3 Likes

Since the cool version have already been done (damn you omgitsalexl!)

if (myBool) myBool = false;
else myBool = true;
2 Likes

Thanks folks :slight_smile:

I do what I can :wink: That aside, I am glad we were able to help you out Tiles.

You all definitely did. Thanks again :slight_smile: