Apama 10.15.1 | Developing Apama Applications | EPL Reference | Statements | Compound statements | The for statement
 
The for statement
The for statement is used to iterate over the members of a sequence and execute the enclosing statement or block once for each member.
The iteration variable is assigned a value successively obtained from each element of the sequence, starting with the first, and if the last sequence entry has not been reached, the statement that forms the loop body is executed.
The iteration variable's type must match the type of the sequence elements.
The loop body is either a single statement or a block.
Within the loop body, the break statement can be used to cause early termination of the loop by transferring control to the next statement after the loop body. The continue statement can be used to transfer control to the end of the body, after which the sequence size is tested to determine if the last entry has been reached. If it has not, then the loop body is executed. The return statement can be used to terminate both the loop and the action that contains it.
For more information, see Defining loops.