Business Process and Data Transformation Language Reference
[Back] [Next]
Go to:

Break out of a loop and exit the loop activity.
Attribute or Element Description
name, disabled, xpos, ypos, xend, yend attributes See Common Attributes and Elements.”
<annotation> element
BPL syntax permits any element that can contain a sequence of activities — <case>, <default>, <foreach>, <false>, <sequence>, <true>, <until>, or <while> — to contain a <break> element if desired.
The <break> element allows the flow of control to exit a loop immediately without completing any more of the operations inside the containing loop. For example:
<while condition="0">

  // various things...

  <if condition="somecondition">

  // various other things...

In the above example, it is the <true> element that contains the <break> element. However, the loop affected by this <break> is actually the containing <while> loop.
The example works as follows: If on some pass through this loop, the <if> element finds “somecondition” to be true (that is, equal to the integer value 1) then the flow of control passes to the <true> element inside the <if>. Upon encountering the <break> element, execution immediately exits the containing <while> loop and proceeds to the next statement following the </while>.
Loop activities that you might want to modify by using a <break> element include <foreach>, <until>, and <while>.
BPL business process code can initiate a sudden, but graceful exit by setting the business process execution context variable status to a failure value using an <assign> or <code> statement.
See Also