How it works

The Iteration operation 'repeat' is the default operation and repeats the contents of the body element as specified in the control element.

If no control is specified the repeat operation will execute once by default. If the control evaluates to a value of zero the repeat operation does not execute and the body is not evaluated. This also means any output [stores] or [objects] are not created.

'Repeat' Examples

Example 1: Simplest Usage

This example has no control and is therefore executed just the once:

<iteration space="repeat">
	<body>wombat</body>
</iteration>
wombat

Example 2: Repeat 'n' times

The number returned by the control (or number of rows in the case of sql) is the number of times the body will be run, in this case 5:

<iteration space="repeat">
	<control value="5" />
	<body value="Foo" />
</iteration>
FooFooFooFooFoo

Example 3: Doubling a number

This example doubles a number 10 times.

<instruction note="declare store 'acc'">
	<output space="store" value="acc" />
	<input value="1" />
</instruction>
<iteration operation="repeat" note="" >
	<control value="10" />
	<body>
		<instruction operation="multiply">
			<output space="store" value="acc" />
			<input value="2" />
			<input space="store" value="acc" />
		</instruction>
	</body>
</iteration>
<instruction note="display acc" >
	<input space="store" value="acc" release="true" />
</instruction>
1024



Last Modified: Thu, 15 Jan 2015