While Loop
- Updated2025-10-31
- 1 minute(s) read
Use the while loop to execute code repeatedly until the condition is no longer met. The code of the loop executes depending on the result of the evaluation.
Every while loop must end with an endwhile.
The syntax is:
while condition
//Code
endwhile
You can exit the loop prematurely with break.
Example: while Loop
program
section globals
int32 stop
endsection
in32 a = 11
while a > 1
a-= 1 // verringere a
if stop == 1 then
break // exit the while loop
endif
endwhile
endprogram