EXIT Statement

Statement: Terminates execution of a DO construct.

Syntax

EXIT [name]

name

(Optional) Is the name of the DO construct.

Description

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.

An EXIT statement must not appear within a CRITICAL or DO CONCURRENT construct if it belongs to that construct or an outer construct.

Example

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

The following shows another example:

    INTEGER numpoints, point
    REAL datarray(1000), sum
    sum = 0.0
    DO point = 1, 1000
      sum = sum + datarray(point)
      IF (datarray(point+1) .EQ. 0.0) EXIT
    END DO

See Also


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.