Do - While
This should be used in situations when you want to loop while a condition is true.
You can test the condition at the top or at the bottom of the loop.
Condition At The Top
This might not be executed because the condition is at the top.
This loops while the variable has a value less than 5 (four times).
Condition At The Bottom
This is executed at least once because the condition is at the bottom.
This loops while the variable has a value less than 5 (four times).
Nested Do - While
You can nest loops inside one another.
In this example you need to reset the inner variable inside the outside loop.
Exit Do
The Exit Do statement lets you exit the loop early.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext