Hell4Ge Posted September 20, 2012 Posted September 20, 2012 (edited) $a = 10 If not $a = 5 Then MsgBox(0, "TADAAAM!", "TADAAAAM!") EndIfMsgBox did not showSo I think that maybe sth is wrong with my brain, but when I asked myself for:- I am drunk?- DId I take the drugs?- Did some1 hit my head with lantern?- Did some dragons / aliens fly over the red lights at crossroad yesterday?Nope, I dont think soThe summary is: What the hell is wrong with this code? NVM My brain is okay, my reading skills are dead at nowBOOLEAN FCK YEAH! Edited September 20, 2012 by Hell4Ge
Spiff59 Posted September 20, 2012 Posted September 20, 2012 (edited) It is due the order in which the comparison is interpreted. AutoIt is seeing "If (Not $a) = 5 Then" If Not ($a = 5) would return different results. Edit: You could also accomplish the same with "If $a <> 5 Then" Edited September 20, 2012 by Spiff59
Kidney Posted September 20, 2012 Posted September 20, 2012 (edited) Typically you use the Not operator for testing/assigning boolean values. Edited September 20, 2012 by Kidney
Blue_Drache Posted September 20, 2012 Posted September 20, 2012 (edited) _SomeFunction() If Not @error then _DoSomething() Else _DoSomethingElse() EndIf The following code will yield the same results _SomeFunction() If @error then _DoSomethingElse() Else _DoSomething() EndIf See? The "Not" just reverses the logic. Edited September 20, 2012 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now