Kilowatt Software's
Classic Rexx Tutorial
Language Level 4.00 (TRL-2)

End instruction

Note: the end instruction is not a true Rexx instruction. It is described here as though it is an instruction for the reader's convenience only.

An end instruction concludes one of the following instruction groups:

A loopControlVariableName can be specified with the end instruction, only when it concludes a a counted do instruction group that has a named control variable. This name is compared versus all active counted loop control variables. The comparison of these names is performed independent of character case.

A name is not permitted with the end instruction, when it concludes a simple do instruction group. Nor is a name permitted with the end instruction, when it concludes a select instruction group.

When multiple do or select instruction groups are pending, the end instruction binds to the nearest incomplete instruction group. You cannot visually determine the associated instruction group of the end instruction, based on the instruction's indentation. Consider the following example:

When multiple iterative do groups are pending, and each of these has a named control variable, then you should specify a name after each of the corresponding end instructions. If an inaccurate control variable is referenced, error 10 (unexpected or unmatched end is raised). For example:

Kilowatt Software's -- Classic Rexx Tutorial -- Back to top
Click here if you have any comments or questions regarding this tutorial

Last updated on: 8 Aug 2002