anystupidassname Posted October 20, 2005 Posted October 20, 2005 This doesn't work... If $var <> "1" OR "2" OR "3' Then Exit EndIf Why not and is there a cleaner way to do it anyway? Say something like this for example: If $var <> ["1"-"3"] Then Exit EndIf This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......
Valuater Posted October 20, 2005 Posted October 20, 2005 I think like this If $var <> "1" OR $var <> "2" OR $var <> "3' Then 8)
Shibuya Posted October 20, 2005 Posted October 20, 2005 If $var <= 3 Then Exit EndIf would that do? The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"
anystupidassname Posted October 20, 2005 Author Posted October 20, 2005 If $var <= 3 Then Exit EndIfwould that do?Heh, nice try, but the var could be anything and I want it to abort unless it is specifically 1, 2, or 3 This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......
LxP Posted October 20, 2005 Posted October 20, 2005 Shibuya, your code would exit if $var contained 2.5, 0 or -2. However such circumstances may not arise (it depends on the code used to assign the value in the first place) and in that case, yours would be the simplest and best way to do this.
CyberSlug Posted October 20, 2005 Posted October 20, 2005 (edited) An alternative, but I don't consider it cleaner: If StringInStr("1|2|3|", $var & "|") Then ... Wait, shouldn't those OR's be AND's? $var <> "1" AND $var <> "2" AND $var <> "3 equivalently: Not ($var = 1 Or $var = 2 Or $var = 3) Edited October 20, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
anystupidassname Posted October 21, 2005 Author Posted October 21, 2005 An alternative, but I don't consider it cleaner:If StringInStr("1|2|3|", $var & "|") Then ...Wait, shouldn't those OR's be AND's?$var <> "1" AND $var <> "2" AND $var <> "3equivalently:Not ($var = 1 Or $var = 2 Or $var = 3)Helpful as always. Thanks Slug! Thanks to the rest of you too.Using OR instead of AND was my main problem.Both:If NOT $var <> "0" AND $var <> "1" AND $var <> "2" Then MsgBox(48, "Abort", "Something fubar!") Exit EndIfand:If NOT StringInStr("0|1|2|", $var & "|") Then MsgBox(48, "Abort", "Something fubar!") Exit EndIfworked. This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......
Valuater Posted October 21, 2005 Posted October 21, 2005 arent these the same For $var = -1 to 4 $var1 = $var If NOT $var <> "0" AND $var <> "1" AND $var <> "2" Then MsgBox(48, "Abort 1" , "Something fubar! " & $var, 3) EndIf If $var1 < "0" Or $var1 > "2" Then MsgBox(48, "Abort 2" , "Something fubar! " & $var1, 3) EndIf Next The first one looks like the long road to get there ???? 8)
LxP Posted October 21, 2005 Posted October 21, 2005 They will both give the same result if you can guarantee that $var holds an integer before you call them.
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