This kind of loop will continually execute until a certain condition is met. Here's an example showing it in action.
exitProgram as integer = 0
while exitProgram <> 1 print ( "inside a while loop" )
sync ( ) endwhile
The condition that determines the loop is specified after the while keyword. Any kind of expression can be used to determine the condition. Our example uses the variable exitProgram, that has an initial value of 0. The while loop will run until exitProgram is different to 1. As this variable is only set to 0 and not altered afterwards the loop will continually run. The loop will only finish if code is added that sets the value of exitProgram to 1.
The loop will only run if the condition is met, otherwise the program execution will move onto the next block of code. This program uses a loop where the condition to run the loop is that the variable exitLoop must be different to 1, but it sets this variable to 1 when it is declared, so what happens is that none of the code associated with this loop runs and the program continues onward.
exitLoop as integer = 1
while exitLoop <> 1 print ( "inside a while loop" )
sync ( ) endwhile
do print ( "fallen into the do loop ") sync ( ) loop