The while loop has the following format:
while (expression)statement
The while statement does the following:
If the expression is False, processing continues with the next statement.
The following example uses a while loop to populate a 10-element array with multiples of five.
a = ArrayNew(1);
loop = 1;
while (loop LE 10) {
a[loop] = loop * 5;
loop = loop + 1;
}
As with other loops, you must make sure that at some point the while expression is False and you must be careful to check your index arithmetic.