while
The while statement is a very useful construction and is the
primary tool for creating loops. It is very flexible since it can have a start
condition, an end condition, or both start and end conditions. There is no method
of breaking out of a while loop. In keeping with the basic design
of SIMPOL, there is one entrance and one exit to the while loop.
![]() | Tip |
|---|---|
SIMPOL doesn't have a |
The basic while loop looks like this:
integer err, i // Basic while loop (similar also to for...next loop), no ending // condition i = 10 while i > 0 i = i - 1 end while // Repeat...until style loop, no starting condition i = 10 while i = i - 1 end while i == 0 // Both conditions in use, the starting condition tests the loop // variable and the ending condition tests the error return value i = 10 err = 0 while i > 0 err = testfunc(i) i = i - 1 end while err == 0
The preceding example shows three different uses of the while
loop. An important point to consider is that the ending condition following
the end while keywords should be read as "end the while
loop if the condition is true".
![]() | Tip |
|---|---|
Please note that the condition must evaluate
to either |



![[Note]](images/note.png)