2.10 User extension

2.10.1 Invoking loop methods

After you have defined a loop method withdefloop, you invoke it with the same syntax that is used for iterating over sequences:

{for|as} var [type-spec]being {each|the} loop-method-name
[preposition expression]*

You use the following syntax to invoke loop methods defined withdefine-loop-method:

{for|as} var [type-spec]being {each|the} loop-method-name
[preposition expression]+

The var argument takes on the value of each element in the data structure expression by using the loop method specified by the loop-method-name argument. The data type of var can be specified by the type-spec argument.

For the purposes of readability, the loop keywordeach should follow the loop keywordbeing when the reference to the elements in the data structure is singular. The loop keywordthe is used afterbeing when a plural reference to the elements of the data structure is made in the loop method. These keywords are syntactically equivalent; you can useeach with plural references andthe with singular references without signaling an error.

Iteration stops when there are no more elements in the specified expression that can be referenced in the way defined by the specified loop method.

Each loop method defined withdefine-loop-method has a set of allowable prepositions, though most loop methods support the prepositionsof andin. For the purposes of parsing loop methods, the loop keywordusing is treated as a preposition.

The Loop Facility - 9 SEP 1996

Generated with Harlequin WebMaker