Unbounded Loops

Unbounded loops are useful when the programmer does not know in advance how many times the loop will be traversed.

This loop repeats an action until an associated test condition returns false or until an exit statement is executed. The condition is evaluated before entering the loop and after each iteration.

Syntax

	while <condition> do
	    <statements>
	end
	

Example

Continue asking until the user chooses "Ok":
	selection as String = ""
	
	while selection /= "Ok" do
	    display "Are you sure ?" 
	        using buttons = ["Ok", "Cancel"] 
	        returning selection = selectedButton                                       
	end