method break
Contract
Return typewob
Parameter keyDefault valueType
valueopt
Water Contract
<method break
  value=opt/>

See also: for_each, return

Normally, a for_each loop will run its full course and return the value of its for_each_result field; however, it is sometimes necessary to escape from a for_each before it expects to finish. A call to break is used to prematurely terminate the current execution sequence, and return a specified value .
Example: A simple break from a for_each loop
<for_each forever=true>
   <break 10 />
</for_each>
10

a wob
Parameter keyDefault valueType
valueopt
The value field specifies the value to be returned from the current execution sequence by the call to break. The value returned from break can be any valid Water object.

a wob
value=skip
In a for_each loop, if break is called with no value, or a value of skip, iteration will stop and for_each will return the value of for_each_result when break was called.
Example: Returning for_each_result
<v 10 20 30 40 50 />.
<for_each combiner=insert>
  <if> value.<equal 30 /> <break skip /> </if>
  value
</for_each>
<v 10 20/>
a wob
value=value
If break has a value, that value will be combined with the for_each_result using the combiner method specified in for_each.
Example: Current for_each value combining with for_each_result
<v 10 20 30 40 50 />.
<for_each combiner=insert>
  <if> value.<equal 30 /> <break value /> </if>
  value
</for_each>
<v 10 20 30/>
a wob
value=wob
Any other Water object value will be combined with the for_each_result using the combiner method specified.
Example: A wob combining with for_each_result
<v "This" " is" " not" " used" />.
<for_each combiner=join>
  <if> value.<equal " not" /> <break " an example" /> </if>
  value
</for_each>
"This is an example"