While And Until

LANSA Composer

While And Until

The While and Until Processing Directives execute the block of their child items iteratively subject to the specified condition.

The While Directive tests the condition at the start of the block.  If the condition is not true when the While Directive is encountered, the block is not executed.

The Until Directive tests the condition at the end of the block.  Therefore, when it is reached, the Until block will always execute at least once.

You can specify the following details for a While or Until Directive:

Condition

Required. Specifies the condition to be tested for this While or Until block. Refer to Conditioning Expressions for information about the syntax of conditioning expressions.

Index variable

Optional. If specified, the Index variable specifies the name of a variable that will receive the index value for each iteration of the While or Until block.

Maximum Iterations

Optional.  This value is intended to prevent unintentional "runaway" loops.  If the value specified is greater than zero, the While or Until block stops executing once the specified number of iterations have been processed, irrespective of the conditioning expression.

The default value is 999.  It is not expected that Processing Sequences will usually use long-running loops.  When a While or Until block ends prematurely due to reaching the maximum iterations an error is raised in the Processing Sequence.