WHILE

Syntax

The WHILE statement creates a loop that executes the statements contained within it until the Boolean expression evaluates to FALSE or an EXIT or RETURN statement within the loop is executed.
WHILE boolean-expression LOOP
  statements
END LOOP;
Where,
boolean-expression

Is a Boolean expression.

statements

Is a series of one or more PL/MX statements.

Examples

A WHILE statement that loops based on a Boolean variable:

WHILE doing_work LOOP
  --- Do some work here.
END LOOP;

A WHILE statement that loops based on the value of a variable:

	WHILE counter < limit LOOP
  --- Do some work…
  counter := counter + 1;
	END LOOP;