PDA

View Full Version : [SOLVED] Quick question about loops



nathan2314
07-03-2008, 09:36 AM
How can I force a do loop to begin the next iteration on a certain condition without finishing the current loop??
For example if I have something like
do until a = 5
if a = 0 then ***
more code...
a = a+1
loop So where the *** is i would be telling the loop to stop there and begin the next loop?
Appreciate any help!

RonMcK
07-03-2008, 09:43 AM
nathan2314,

You could do something like this:

Do Until a = 5
If a = 0 Then GoTo LOOP_DONE
' more code...
LOOP_DONE:
a = a + 1
Loop
I think this should get your job done

nathan2314
07-03-2008, 09:51 AM
Ahh that worked perfectly :thumb

Thanks!

Bob Phillips
07-03-2008, 09:51 AM
Why not just




Do Until b = 10
'more code...
b = b + 1
Loop
Do Until a = 5
'more code...
a = a + 1
Loop