## 7.5.5 EXIT Statement

The EXIT statement terminates execution of a DO construct. It takes the following form:

  EXIT [name]
  name
  Is the name of the DO construct.

Rules and Behavior

The EXIT statement causes execution of the named (or innermost) DO construct to be terminated.

If a DO construct name is specified, the EXIT statement must be within the range of that construct.

Any DO variable present retains its last defined value.

An EXIT statement can be labeled, but it cannot be used to terminate a DO construct.

Examples

The following example shows an EXIT statement:

    LOOP_A : DO I = 1, 15
      N = N + 1
      IF (N > I) EXIT LOOP_A
    END DO LOOP_A

Previous Page Next Page Table of Contents