emmanuel Posted May 7, 2004 Share 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) Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 7, 2004 Administrators Share 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/ Link to comment Share on other sites More sharing options...
scriptkitty Posted May 7, 2004 Share 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. Link to comment Share on other sites More sharing options...
emmanuel Posted May 7, 2004 Author Share 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) 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