While statement

The EGL while statement runs a set of statements in a loop. Every iteration of the loop depends on whether a logical expression resolves to true.

Syntax



Syntax diagram for the for statement

label
A label that a continue or exit statement can reference.
logicalExpression
An expression that resolves to true or false.
statement
An EGL statement.
After the following code runs, the value of sum is 30:
inputList int[] = [2,4,6,8,10];
sum int = 0;
counter int = 1;
numberInList int = inputList.getSize();

while (counter <= numberInList)
   sum = inputList[counter] + sum;
   counter = counter + 1;
end

Compatibility

Table 1. Compatibility
Target Issue
Java No issues
JavaScript No issues.