MattM2013 Posted August 16, 2013 Report Share Posted August 16, 2013 To anyone willing to help: I have a loop that reads like this: Repeat Until %T1% = "" body of function Repeat End However, I want to insert a counter potentially into a variable within the loop so that when the function is done once, one set of instructions is needed. If the function is done twice then do this, if done three or more times then do this. Anyone know of a way to make it happen? Thanks Quote Link to comment Share on other sites More sharing options...
acantor Posted August 17, 2013 Report Share Posted August 17, 2013 Maybe something like this? Variable Set Integer %N1% to 0 Repeat Until %T1% Equals "" // Body of Repeat Loop Variable Modify Integer %N1%: Increment End Repeat // Check the value of %N1%, and decide what to do with it. Switch( %N1% ) Case: 0 // Do this if %N1% = 0 End Case Case: 1 // Do this if %N1% = 1 End Case Case: 2 // Do this if %N1% = 2 End Case Default Case // Do this if %N1% = 3 or more End Case End Switch Quote Link to comment Share on other sites More sharing options...
MattM2013 Posted August 19, 2013 Author Report Share Posted August 19, 2013 I'm going to try this today. I'll let you know the results of it. Thanks for the input! Quote Link to comment Share on other sites More sharing options...
MattM2013 Posted August 19, 2013 Author Report Share Posted August 19, 2013 Maybe something like this? Variable Set Integer %N1% to 0 Repeat Until %T1% Equals "" // Body of Repeat Loop Variable Modify Integer %N1%: Increment End Repeat // Check the value of %N1%, and decide what to do with it. Switch( %N1% ) Case: 0 // Do this is %N1% = 0 End Case Case: 1 // Do this is %N1% = 1 End Case Case: 2 // Do this is %N1% = 2 End Case Default Case // Do this is %N1% = 3 or more End Case End Switch Thanks Alan!!!! Worked flawlessly!!! But what exactly is the significance of the "Switch" command? Quote Link to comment Share on other sites More sharing options...
acantor Posted August 19, 2013 Report Share Posted August 19, 2013 SWITCH is a clearer alternative to IF THEN ELSE statements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.