LF Fortran 95

EXIT Statement

Description

The EXIT statement causes execution of a specified DO loop to be terminated. Execution continues at the first executable statement after the loop terminus.

Syntax

EXIT [do-const-name]
Where:

do-const-name is the name of a DO construct that contains the EXIT statement.

Remarks

If do-const-name is omitted, the EXIT statement applies to the innermost DO construct in which the EXIT statement appears.

Example

integer :: i, j outer: do i=1, 10 inner: do j=1, 10 if (i < j) then exit ! exits inner else if (i > j) then cycle else write(*,*) i,j exit outer end if end do inner end do outer

See Also

CYCLE Statement

DO Construct