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.
ForStatement
Rule components
The expression, which must produce a reference to a sequence or a dictionary’s key, is evaluated. Then the IterationVariable 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 IterationVariable’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.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.