emmanuel 0 Posted May 7, 2004 so, people say that select is better for some things, and If better for others... Which is better for what? (I guess that's the short version of the question) "I'm not even supposed to be here today!" -Dante (Hicks) Share this post Link to post Share on other sites
Jon 1,009 Posted May 7, 2004 It's mostly a personal thing. Anything more than 3 "if" or "elseif" choices and I would use Select. But then other devs would use elseif for many more. The basic rule would be "for a few choice" use if/else/elseif. Otherwise use Select. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Share this post Link to post Share on other sites
scriptkitty 1 Posted May 7, 2004 The basic rule would be "for a few choice" use if/else/elseif. Otherwise use Select.and for a lot of choices use a loop. $aX=Stringsplit("1,2,3,4,5,6,7,8,bob,fred,jill",",") $answer="notfound" for $i=1 to $aX[0] if $aX[$i]="bob" then $answer="found" Next MsgBox(1,"",$answer) AutoIt3, the MACGYVER Pocket Knife for computers. Share this post Link to post Share on other sites
emmanuel 0 Posted May 7, 2004 and for a lot of choices use a loop.ok, I almost get this, I want to walk through it to see if I do. $aX=Stringsplit("1,2,3,4,5,6,7,8,bob,fred,jill",",")that part the string and splits it based on the "," $answer="notfound"sets the default answer for $i=1 to $aX[0]$aX[0] would be the number of lines in the array, correct? And the For makes it loop that many times, right? if $aX[$i]="bob" then $answer="found"checks $aX[$1] if it's "bob" then changes $answer to found... Nextit does all of that up to the next as many times as was set at the begining... MsgBox(1,"",$answer)ok, cool, didn't quite get that till I walked through it... "I'm not even supposed to be here today!" -Dante (Hicks) Share this post Link to post Share on other sites