WHILE statement

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

WHILE statement

mapp Services V5.16

Statements can be executed repeatedly with the WHILE statement.

Syntax

WHILE <expression> DO
    <statement_list>
END_WHILE;

The statements in <statement_list> are repeatedly executed until expression <expression> returns the value TRUE. If expression <expression> returns FALSE during the very first evaluation, then the statements in <statement_list> are never executed.

If expression <expression> never has the value FALSE, then the statements will iterate infinitely, causing a runtime error.

Example

WHILE Var1 <> 0 DO
    Var2 := Var2 * 2;
    Var1 := Var1 - 1;
END_WHILE;