armyman 0 Posted March 22, 2011 Hello all, I'm trying to write a Select ... Case statement that compares string values. The code is pretty simple I'm just havng problems comparing the string values. Select Case $xyz = "" ;xyz values is blank ;does something Case $xyz = 'abc' OR 'xyz' ;xyz value is either abc or xyz ;does something Else Case Else ;xyz value is anything else Thanks in advance Share this post Link to post Share on other sites
bwochinski 2 Posted March 22, 2011 (edited) The 2nd CASE statement needs to be written like below... Select Case $xyz = "" ;xyz value is empty Case $xyz = 'abc' OR $xyz = 'xyz' ;xyz value is either abc or xyz Case Else ;xyz value is anything else EndSelect Edited March 22, 2011 by bwochinski Share this post Link to post Share on other sites
JohnOne 1,603 Posted March 22, 2011 Maybe a Switch might be better. Switch $xyz Case "" ;xyz value is empty Case 'abc', 'xyz' ;xyz value is either abc or xyz Case Else ;xyz value is anything else EndSwitch AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
Bowmore 97 Posted March 22, 2011 (edited) If you are comparing 1 value against several possible values, you could also use a switch statement. Switch $xyz Case "" ;xyz value is empty Case 'abc' ,'xyz' ;xyz value is either abc or xyz Case Else ;xyz value is anything else EndSwitch Edit: John beat me to it Edited March 22, 2011 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Share this post Link to post Share on other sites
armyman 0 Posted March 22, 2011 Thanks all, I went ahead and used the switch statemnet. Share this post Link to post Share on other sites