tarre Posted September 21, 2008 Share Posted September 21, 2008 Hellow fellas. im wondering what <> and == means in if-stats i know what < and >, = means but not <> and == . so could anyone tell me ? Link to comment Share on other sites More sharing options...
therks Posted September 21, 2008 Share Posted September 21, 2008 Hellow fellas. im wondering what <> and == means in if-statsi know what < and >, = means but not <> and == . so could anyone tell me ?<> means not equal.ie: (1 <> 2) true== is only for strings, and means case sensitive equal.ie: ('Hello' == 'hello') false('Hello' == 'Hello') trueLook in the help file under Operators. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
tarre Posted September 21, 2008 Author Share Posted September 21, 2008 okay. thx Link to comment Share on other sites More sharing options...
rudi Posted September 21, 2008 Share Posted September 21, 2008 <> means not equal. ie: (1 <> 2) true == is only for strings Almost. Boolean values also take advantage of "==" as comparing operand as well: if 0 = False Then MsgBox(0,"one ""="" used","0=False is true") Else MsgBox(0,"one ""="" used","0=False is *NOT* true") EndIf if 0 == False Then MsgBox(0,"two ""=="" used","0==False is true") Else MsgBox(0,"two ""=="" used","0==False is *NOT* true") EndIf Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
therks Posted September 29, 2008 Share Posted September 29, 2008 Not exactly as you think. You know what's happening there? The == is converting False and 0 into strings. So it's not comparing Boolean(False) to Integer(0), it's comparing String(0) to String(False) (which obviously returns false). Case in point: MsgBox(0, 'False = "False"', False = "False") MsgBox(0, 'False == "False"', False == "False") Sorry to revive an old thread, but I had to correct this incorrect thinking. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
rudi Posted October 1, 2008 Share Posted October 1, 2008 (edited) Not exactly as you think. You know what's happening there? The == is converting False and 0 into strings. So it's not comparing Boolean(False) to Integer(0), it's comparing String(0) to String(False) (which obviously returns false). Case in point: MsgBox(0, 'False = "False"', False = "False") MsgBox(0, 'False == "False"', False == "False") Sorry to revive an old thread, but I had to correct this incorrect thinking. I see, thanks for clarifying! I used it so far for If <expression> Then statements, when I wanted to be sure, that it's not a "0" (which is resulting in the same action as a boolean "False") but a real, boolean "False". But due to your esplanation, this doesn't ensure that as well. So I think I'd need to use if (not <expression>) and (<expression> == "False") then to ensure, that <expression> is really a boolean "False", right? The first one checks, that it's not the String "False", the 2nd one, that it's not "0". Regards, Rudi. Edited October 1, 2008 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
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