The do/while loop is a variation of the while loop. It executes the code block once before checking the condition. Then, it repeats the loop as long as the condition remains true.
do
|
The subsequent example using a do/while loop ensures that the loop runs at least once, regardless of the initial truth value of the condition. This is because the code block executes before the condition is checked:
|
Remember to increment the variable utilized in the condition, or else the loop will continue indefinitely. |