Jump to content
Sign in to follow this  
Habland0

Bool flip

Recommended Posts

Habland0

What is the most efficient manner of flipping a bool? Here is the shortest way I can think of:

If $bool Then
$bool = False
Else
$bool = True
EndIf

However some programming languages allow:

$bool = !$bool

(i.e. True = Not True, False = Not False)

Is anything like this single line approach possible in AutoIt?

Edited by Habland0

Share this post


Link to post
Share on other sites
omikron48

$bool = Not $bool

Next time, spend some time reading the help file, specially the Language Reference section.

Share this post


Link to post
Share on other sites
Habland0

Next time, spend some time reading the help file, specially the Language Reference section.

I was reading that section this afternoon. It must have completely slipped my gaze, because I don't recall reading anything about dealing with booleans. I just looked it up again and found it immediately - thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×