michaelslamet Posted August 10, 2013 Share Posted August 10, 2013 This look so noob and seems so inefficent: If $avar = "" OR $another_var = "" OR $c1 = "" OR $d_var = "" OR $e_var = "" OR $another_var_again = "" OR $another_var_again2 = "" then .... EndIf Is there another way to write that If with many OR like above? Link to comment Share on other sites More sharing options...
jaberwacky Posted August 10, 2013 Share Posted August 10, 2013 (edited) Here's how I would do it, one way among many really. Not really inefficient I think. If Not $avar OR _ Not $another_var OR _ Not $c1 OR _ Not $d_var OR _ Not $e_var OR _ Not $another_var_again OR _ Not $another_var_again2 then .... EndIf lookit how pritty Edited August 10, 2013 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
0xdefea7 Posted August 10, 2013 Share Posted August 10, 2013 Not as pretty, as jabberwocky6669's code, but it should work the same: $a = 0 $b = 1 Switch "" Case $a MsgBox(0, "", "Not $a") Case $b MsgBox(0, "", "Not $b") EndSwitch Link to comment Share on other sites More sharing options...
MHz Posted August 10, 2013 Share Posted August 10, 2013 $avar = 'a' $another_var = 'b' $c1 = 'c' $d_var = 'd' $e_var = 'e' $another_var_again = 'f' $another_var_again2 = '' Switch '' Case $avar, $another_var, $c1, $d_var, $e_var, $another_var_again, $another_var_again2 MsgBox(0, '', 'It is an empty string, zero, false or anything else that is nothing') EndSwitch If you want to check for an empty string then you may need to use == in the 1st post Link to comment Share on other sites More sharing options...
michaelslamet Posted August 10, 2013 Author Share Posted August 10, 2013 Aha, what is different between "=" and "==" ? Because I never use "==" before. I'm open this thread because I remember I see it somewhere that (guiness??) write something like: OR ($avar, $another_var, $cl, $d_var, $e_var, $another_var_again, $another_var_again2) but I'm not remember about it and what is for Link to comment Share on other sites More sharing options...
jaberwacky Posted August 10, 2013 Share Posted August 10, 2013 It's in the Operators section of the helpfile. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
MHz Posted August 10, 2013 Share Posted August 10, 2013 Look at the help file AutoIt -> Language Reference -> Operaters unofficially: = will check the value. i.e. is it something, is it nothing, is it a numerical comparison etc. == will check whether this string equals that string with case sensing. Like a contents check rather then a value check. If you check for "" then it will be true only if it is "". 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