Linda Posted August 27, 2004 Report Share Posted August 27, 2004 Hi! If someone already has a more elegant solution for this, or if I've missed a built-in feature, please let me know . I had been somewhat irritated by the lack of a "next iteration" function for the ME repeat loops (at least in 3.0.4.1) -- functionality that would let you skip the rest of this iteration of the loop, and begin the next iteration. I've been spoiled by it in other languages. But, behold! It is possible to do this in ME! Immediately inside your Repeat loop, create a second, inner repeat loop that simply says "Repeat 1 Times". Now, using "Repeat Exit" will jump you out of the inner repeat loop- and back to the beginning of the next iteration of the outer loop! To be able to also really "Repeat Exit" the outer loop from the inner one, you can define a "Really Exit?" variable, and have code at the bottom of the outer loop check this and "Repeat Exit" if it = 1 or "true" or whatever. Posting this in hopes that someone else will also find it useful. Quote Link to comment Share on other sites More sharing options...
joe Posted August 29, 2004 Report Share Posted August 29, 2004 Hello Linda! Can you post an example of your solutiion? I'm trying to envision it, but now my brain hurts Quote Link to comment Share on other sites More sharing options...
Linda Posted August 30, 2004 Author Report Share Posted August 30, 2004 Sorry, I guess I wasn't very clear, was I? Is this better: // T1 = Break all the way out of loop? (True/False) Variable Set String %T1% "False" // // Any type of "Repeat" or file-reading loop // will work for the outer repeat loop Repeat with Variable using %N2% Repeat Start (Repeat 1 times) If <some condition> // Do some processing // now we want to go to the next iteration // of the %N2% loop Repeat Exit end if // Do some other processing if <some other condition> // Do some processing // now we want to exit the repeat loop entirely Variable Set String %T1% "True" Repeat Exit end if if <yada yada yada> // Process, process, process // Next iteration: Repeat Exit end if // do some processing if <etc> // ... end if Repeat End // if Variable %T1% = "True" Repeat Exit end if Repeat End Quote Link to comment Share on other sites More sharing options...
jmb4370 Posted August 31, 2004 Report Share Posted August 31, 2004 Hi there, Very nice tip! I am keeing that one in my file. Thanks! Michael 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.