The statement While is used to repeat a loop based on a condition.
Syntax
While <Boolean expression>
Do
...;
Od;
The condition is (re) evaluated before every iteration of the loop. If the condition evaluates to True the loop is executed. If the condition evaluates to False, ITP/Server will continue with the next statement following the Od.
The Break command can be used to terminate the loop unconditionally.
Example
Parameter Text String;
While String <> ""
Do
Progress Message (substring (String, 1, 1));
String = rsubstring (String, 2, 0);
Od;
This script sends all characters from the parameter to the client, one character at a time. Note the use of rsubstring. This function returns the input string minus the first character: the 2 parameter takes care of that, the 0 parameter says that no characters must be left out from the end of the input string.