The CYCLE statement interrupts the current execution cycle of the innermost (or named) DO construct.
The CYCLE statement takes the following form:
When a CYCLE statement is executed, the following occurs:
If a DO construct name is specified, the CYCLE statement must be within the range of that construct.
Any executable statements following the CYCLE statement (including a labeled terminal statement) are not executed.
A CYCLE statement can be labeled, but it cannot be used to terminate a DO construct.
Examples
The following example shows a CYCLE statement:
DO I =1, 10
A(I) = C + D(I)
IF (D(I) < 0) CYCLE ! If true, the next statement is omitted
A(I) = 0 ! from the loop and the loop is tested again.
END DO