Developing Apama Applications > Apama EPL Reference > Statements > Compound statements > The while statement
The while statement
The while statement is used to repeatedly evaluate a boolean expression and execute a block as many times as the expression result is found to be true.
WhileStatement
Rule components
The expression, whose result type must be boolean, is evaluated and if the result is true, the block is executed. Control then transfers to the top of the loop and the expression is evaluated again. When the expression result is false, control is transferred to the next statement following the while statement.
The body of the loop must be a block; it must be inside curly braces.
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 expression will be evaluated again and the loop body executed if the expression result is true. The return statement can be used to terminate both the loop and the action that contains it.
Copyright © 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.