CONTINUE(7) - [EXECUTION_CONTROL] execution of a CONTINUE statement has no effect
[NNNNN] continue
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:
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.
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. 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.
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 > endFortran statement descriptions (license: MIT) @urbanjostprogram 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
Nemo Release 3.1 | continue (7fortran) | February 19, 2025 |