t0ddie Posted December 8, 2004 Share Posted December 8, 2004 i dont know how to use the or operator. when i run this code, i get an error saying that if statements must have a then statement. if $diecode <> 1000 Or 0100 Or 1010 Or 0110 Or 1110 Or 0111 Then $diecode = "error" EndIf please, tell me whats wrong here lol. thanks. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
MHz Posted December 8, 2004 Share Posted December 8, 2004 Try thisif $diecode <> 1000 Or 0100 Or 1010 Or 0110 Or 1110 Or 0111 Then $diecode = "error" EndIf Link to comment Share on other sites More sharing options...
Helge Posted December 8, 2004 Share Posted December 8, 2004 (edited) Look at this example : If "blubba" = "blabby" or "blubb" = "blubb" Then MsgBox(64,"","Hi Blubba/Blubb !") Else MsgBox(64,"","Damn..where is Blubba and Blubb ?") EndIf Good luck ! (Edit : me....types....slow....morning...zzz) Edited December 8, 2004 by Helge Link to comment Share on other sites More sharing options...
Henrik Posted December 8, 2004 Share Posted December 8, 2004 (edited) $diecode <> 1000 Or 0100...please, tell me whats wrong here lol. thanks.<{POST_SNAPBACK}>If I got the AutoIt syntax right, the clear text equivalent of this is:"If it is true that $diecode is not equal to 1000 or if 0100 is true, then this expression is true, otherwise it is false."Since 0100 means true (all non-zero numbers mean true), this expression is always true.OTOH, if I read your mind correctly, you actually wanted to say:"If it is true that $diecode is neither equal to 1000 nor equal to 0100, then this expression is true, otherwise it is false."That is: $diecode <> 1000 And $diecode <> 0100much like Helge's example. BTW never mind the strange strings in Helge's example. In Norway they talk (and perhaps even think) like that.You can try using parentheses to make expressions with And and/or Or easier to understand.($diecode <> 1000) Or (0100) ($diecode <> 1000) And ($diecode <> 0100)Edit: corrected Or/And mistakes , thanxalot to philip123adams Edited December 8, 2004 by Henrik Ignorance is strength. Link to comment Share on other sites More sharing options...
phillip123adams Posted December 8, 2004 Share Posted December 8, 2004 I think you have two issues. One is, I think, you want to use "And" instead of "Or" in this case. The second is if you want to span multiple lines end each line, that is spanning, with an underscore character. The lack of underscores is what produced the error statement. $Diecode = "abc" if $diecode <> 1000 And _ $diecode <> 0100 And _ $diecode <> 1010 And _ $diecode <> 0110 And _ $diecode <> 1110 And _ $diecode <> 0111 Then $diecode = "error" EndIf msgbox(4096, "answer", $Diecode) Phillip Link to comment Share on other sites More sharing options...
t0ddie Posted December 9, 2004 Author Share Posted December 9, 2004 ok, when i add this... $Diecode = "abc" if $diecode <> 1000 And _ $diecode <> 0100 And _ $diecode <> 1010 And _ $diecode <> 0110 And _ $diecode <> 1110 And _ $diecode <> 0111 Then $diecode = "error" EndIf i get an error at line 85, and it never did that before. this is line 85. $diecode1 & $diecode2 & $diecode3 & $diecode4 = $diecode and the error i get is Error: Expected a "=" operator in assignment statement. whats wrong here? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Valik Posted December 9, 2004 Share Posted December 9, 2004 Uhhhh, what in the hell are you trying to do with that line of code? Link to comment Share on other sites More sharing options...
phillip123adams Posted December 9, 2004 Share Posted December 9, 2004 ok, when i add this...$Diecode = "abc"if $diecode <> 1000 And _$diecode <> 0100 And _$diecode <> 1010 And _$diecode <> 0110 And _$diecode <> 1110 And _$diecode <> 0111 Then$diecode = "error"EndIfi get an error at line 85, and it never did that before.this is line 85.$diecode1 & $diecode2 & $diecode3 & $diecode4 = $diecodeand the error i get is Error: Expected a "=" operator in assignment statement.whats wrong here?<{POST_SNAPBACK}>The statement is structured backward. It should be:$diecode = $diecode1 & $diecode2 & $diecode3 & $diecode4 Phillip Link to comment Share on other sites More sharing options...
CyberSlug Posted December 9, 2004 Share Posted December 9, 2004 If Not StringInString("1000,0100,1010,0110,1110,0111" , $diecode) Then $diecode = "error" EndIf Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
t0ddie Posted December 9, 2004 Author Share Posted December 9, 2004 (edited) If Not StringInString("1000,0100,1010,0110,1110,0111" , $diecode) Then $diecode = "error" EndIf<{POST_SNAPBACK}>excellent work.i learn alot from this forum. thanksEDIT: StringInStr Edited December 9, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. 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