while

The EGL keyword while marks the start of a set of statements that run in a loop. The first run occurs only if a logical expression resolves to true, and each subsequent iteration depends on the same test. The keyword end marks the close of the while statement.

Syntax diagram for the while statement
logical expression
An expression (a series of operands and operators) that evaluates to true or false
statement
A statement in the EGL language

An example is as follows:

  sum = 0;
  i = 1;
  while (i < 4)
    sum = inputArray[i] + sum;
    i = i + 1;
  end

Related tasks
Syntax diagram for EGL statements and commands

Related reference
Logical expressions
EGL statements

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.