Jump to content

Recommended Posts

Posted (edited)

We all know about "If something = something then" but what about "If something ≠ something then"? Didn't find any help on any does not equal command in the autoit help file, does something like this exist? If not is there any way around this, maybe using <> instead of ≠ which I know doesnt' work :whistle:?

Edited by ravenfyre
Posted

If Not ($x = $y)

Interesting, I always thought that "=" was assignment, and "==" was comparison...

Then again "!=" doesn't seem to work in AutoIt, so I have no clue what to think. :whistle:

Posted

Instead of using !=, use <>. You could also do something like (untested):

$x=6

If Not $x = 5 Then

MsgBox(0,"Test","$x isn't equal to 5.")

Else

MsgBox(0,"Test","$x is equal to 5.")

EndIf

Sincerely yours,Jeremy Landesjlandes@landeserve.com

Posted

Instead of using !=, use <>...

Thanks for advice... Though, I was joking when I made the comment about "!=". :whistle:

(Hmm, there needs to be a :shrug: emoticon here)

Posted

Instead of using !=, use <>.  You could also do something like (untested):

$x=6

If Not $x = 5 Then

  MsgBox(0,"Test","$x isn't equal to 5.")

Else

  MsgBox(0,"Test","$x is equal to 5.")

EndIf

$x=6

If Not($x = 5) Then
  MsgBox(0,"Test","$x isn't equal to 5.")
Else
  MsgBox(0,"Test","$x is equal to 5.")
EndIf

Need to have the parenthesis around the condition being evaluated for NOT to work properly.

Posted

Hmmm. It seems to have worked fine for me in the past without the parens. Thanks for letting me know.

Sincerely yours,Jeremy Landesjlandes@landeserve.com

Posted

Hmmm.  It seems to have worked fine for me in the past without the parens.  Thanks for letting me know.

I think Jon updated the order of operations in one beta.

The precedence of operations, from highest to lowest:

    ( )

    NOT

    ^

    * /

    + -

    &

    < > <= >= = <> ==

    AND OR

Thus, Not $x = $y evaluates as (Not $x) = $y
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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
  • Recently Browsing   0 members

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