Jump to content

NOT operator, how it works?


Hell4Ge
 Share

Recommended Posts

$a = 10 If not $a = 5 Then MsgBox(0, "TADAAAM!", "TADAAAAM!") EndIf

MsgBox did not show

So 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 so

The summary is: What the hell is wrong with this code? :o

NVM :P

My brain is okay, my reading skills are dead at now

BOOLEAN FCK YEAH!

Edited by Hell4Ge
Link to comment
Share on other sites

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 by Spiff59
Link to comment
Share on other sites

_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 by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...