Oracle Waveset 8.1.1 Deployment Reference

break Function

Forces early termination of an expression. A break can be used within the following expressions: block, dolist, while, and, or. The value of the break expression becomes the value of the containing expression. The break can cause the termination of several levels of expression when the optional block name is used.

Example 1

The following expression contains a simple break terminating a loop.

<dolist name=’el’>
<ref>list</ref>
   <cond><eq><ref>el</ref><s>000</s></eq>
      <break>
         <ref>el</ref>
      </break>
   </cond>
<null/>
</dolist>

In this example, the dolist function iterates over the elements of a list looking for value 000. The value of the dolist function is a list formed by concatenating the values that are returned by the last subexpression in each iteration.

Example 2

The following expression demonstrates the use of a block name to break through more than one level.

<block name=’outer block’>
  <dolist name=’el’>
    <ref>listOfLists</ref>
    <dolist name=’el2’>
      <ref>el</ref>
      <cond><eq><ref>el</ref><s>000</s></eq>
        <break name=’outer block’>
          <ref>el</ref>
        </break>
      </cond>
    </dolist>
    <null/>
  </dolist>
</block>

This is similar to the previous example except that there are two loops. The outer loop iterates over a list whose elements are themselves lists. The inner loop iterates over the element lists. When the value 000 is found, both loops are terminated by referencing the block name outer block in the break expression.