Skip to main content

<break>

Break out of a loop and exit the loop activity.

Syntax

<break/>

Attributes and Elements

name, disabled, xpos, ypos, xend, yend attributes

Description

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">

  //...do various things...

  <if condition="somecondition">
    <true>
      <break/>
    </true>
  </if>

  //...do various other things...

</while>

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>.

Note:

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

FeedbackOpens in a new tab