Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

flipping a boolean

So in many languages you can flip a boolean by the following statement:

var = ! var;

 

So if the boolean var = true, then after the statement it will be flipped to false. Is there something like this in PS? I looked through the help and the forum, but couldn't find anything.

 

I know I could just do:

if var = true

   var = false

else 

   var = true

end

 

But that is SOOO many lines of code! My RAM is precious you know.

 

Many thanks.

1 REPLY
Solution
Solution
Accepted by topic author EMM
‎10-25-2016 03:19 PM

Re: flipping a boolean

Sorry, I found it:

 

var := not var

 

"not" is the same as !