DoWhile and DoUntil Looping Constructs

You have already seen that the For/Next statement is typically used when you have some foreknowledge of the number of iterations you want to perform. The Do statements, on the other hand, are useful for those times when you are uncertain how long it might take for a terminating condition to be met (such as when gathering user input).

Do/While and Do/Until are (in many ways) interchangeable. Do/While keeps looping while the terminating condition is true. On the other hand, Do/Until keeps looping until the terminating condition is true. For example:

Was this article helpful?

0 0

Post a comment