BREAK statement
Use the BREAK statement in conjunction with the FOREACH statement to break out of the processing of a loop before the loop is completely processed.
The behavior of the BREAK statement is as follows:
- If the BREAK statement is contained in a FOREACH statement, when the BREAK statement is processed, processing of the FOREACH loop is terminated immediately. Processing continues with the next statement after the FOREACH statement. If the statement contains nested FOREACH statements, only the innermost loop containing the BREAK statement is exited.
- If the BREAK statement is outside of a FOREACH statement, the
BREAK statement terminates the processing of the rules for the current
event. No more rules are processed after the BREAK but the event is
still sent to the ObjectServer (unlike the
discard
function).
For additional information, see Examples of the looping function.