ravenfyre Posted February 6, 2004 Posted February 6, 2004 (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 ? Edited February 6, 2004 by ravenfyre
scriptkitty Posted February 6, 2004 Posted February 6, 2004 $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.
CyberSlug Posted February 6, 2004 Posted February 6, 2004 If $x <> $y If Not ($x = $y) If Not ($x == $y) Note that == is a case-sensitive comparison while = is case-insensitive. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Bartokv Posted February 6, 2004 Posted February 6, 2004 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.
jlandes Posted February 7, 2004 Posted February 7, 2004 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
Bartokv Posted February 7, 2004 Posted February 7, 2004 Instead of using !=, use <>...Thanks for advice... Though, I was joking when I made the comment about "!=". (Hmm, there needs to be a :shrug: emoticon here)
Valik Posted February 7, 2004 Posted February 7, 2004 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.
jlandes Posted February 7, 2004 Posted February 7, 2004 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
CyberSlug Posted February 7, 2004 Posted February 7, 2004 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 ORThus, 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!
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