LF Fortran 95

EXIT Statement


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


EXIT [do-const-name]

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


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


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