loop90.f

C  Author:   Mitch Richling<http://www.mitchr.me/>
C  IP:       Copyright 1993 by Mitch Richling.  All rights reserved.
C  Key word: FORTRAN f77 f90 fortran90 exit repeat until while do
C  Notes:    Illustrates the standard do/enddo construct from 
C            FORTRAN 90.  This feature is quite commonly 
C            available in many Fortran 77 compilers including
C            g77 (GNU Fortran 77).

C             LOOP construct in Fortran 90
      program loop90

      real X

C     The Fortran 90 loop construct uses an if/exit to exit any do/enddo
C     loop.  If the exit is at the top, the loop can be like a while-do
C     and if it is at the bottom it can be like a repeat-until/do-while.
      X = 5
      do
        X = X - 1
        write (*,*) 'X=', X
        if (X .le. 3) exit
      end do

      end

Generated by GNU Enscript 1.6.5.2.