Manual Reference Pages  - continue (7fortran)

NAME

CONTINUE(7) - [EXECUTION_CONTROL] execution of a CONTINUE statement has no effect

SYNOPSIS

[NNNNN] continue

DESCRIPTION

It is generally very confusing to have executable statements on labeled lines; a CONTINUE statement eliminates the ambiguities that arise in jumping to an executable line. Specifically:
o Execution of a CONTINUE statement has no effect.
o Preferably no target of a transfer should be an executable statement.
o Therefore, all numerically labeled executable lines should be a CONTINUE.
A CONTINUE statement is most often used as a target for transfer control statements such as GOTO. That is, a numeric label is added to the line.

CONTINUE(7f) is rarely used in new code but was very commonly encountered in older FORTRAN code before the advent of constructs like ENDDO, CYCLE, BLOCK, and EXIT.

EXAMPLES

Sample program:

    >      program oldstyle
    >      integer i,j
    >      j=5
    >      do 100 i=1,20
    >         if(i.lt.5)goto 100
    >         j=3
    >100   write(*,*)’J=’,j
    >      end

program demo_continue ! numbered targets should (almost?) always be a continue statement ! with a unique label for each looping structure integer :: i,j j=5 do 100 i=1,20 if(i.lt.5)goto 50 j=3 50 continue write(*,*)’J=’,j 100 continue end program demo_continue

program newer implicit none integer :: i,j j=5 do i=1,20 if(i >= 5)then j=3 endif write(*,*)’J=’,j enddo end program newer

Fortran statement descriptions (license: MIT) @urbanjost


Nemo Release 3.1 continue (7fortran) August 19, 2024
Generated by manServer 1.08 from f049d012-496b-4685-9e80-ebb64c524918 using man macros.