two-condition loop

J

Jamie Martin

I am getting input from a user. After stage 1, he must verify what he has
entered. After stage 2, he must also verify what he's entered. However, if
either stage has errors, he needs to start again from the beginning. I
cannot do this (I tried):

Do
<instructions>
Loop Until Condition1 = True
<instructions>
Loop Until Condition2 = True

I could do what I want with a GoTo, but I understand that is poor practice
because it makes one's code unfollowable. Is there another structure I can
use that will be equivalent to the above?
 
E

Earl Kiosterud

Jamie,

You seem to be saying that if the user does part 1 correctly, but muffs part
two, that he must start over with part 1. I think you're almost there.

Do
Do
Part 1 steps
Loop until Part1OK
Part 2 Steps
Loop until part2OK = True
 
J

Jamie Martin

That's exactly what I want. Thanks.

Earl Kiosterud said:
Jamie,

You seem to be saying that if the user does part 1 correctly, but muffs part
two, that he must start over with part 1. I think you're almost there.

Do
Do
Part 1 steps
Loop until Part1OK
Part 2 Steps
Loop until part2OK = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top