<break>
Syntax
<break/>
Attributes and Elements
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>.