Sign in to follow this  
Followers 0
ravenfyre

Does Not Equal Command?

9 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



$x=4
if $x=3 then
else
msgbox(1,"it worked","$x="&$x)
endif

if $x<>3 then msgbox(1,"it worked again","$x="&$x&" not 3")


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

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  
Followers 0