Do-While Loop
- Updated2025-10-31
- 1 minute(s) read
Use the do-while loop to execute code repeatedly until the condition is no longer met. The condition is not evaluated until after the loop code executes.
The syntax is:
do
// Code
while condition
No endwhile is required for this type of loop.
You can exit the loop prematurely with break.
Example: do-while Loop
program
int32 c = 10
do
c = c - 1
while c > 1
endprogram