next up previous contents
Next: The IF Statement Up: More on Flow Control Previous: More on Flow Control   Contents

Named IF and DO Blocks

Naming IF blocks is mainly cosmetic, but is useful to improve readability when nested IF blocks are used (nesting can go to any depth!). For example

lev0: if (a.gt.b) then
        print*, "a is larger"
      elseif (a.lt.b) then    lev0
lev1:  if (b.gt.c) then
          print*, "b is larger"
        elseif (b.lt.c) then lev1
lev2:     if (c.gt.d) then
            print*, "c is larger"
          end if lev2        
        end if   lev1
      end if     lev0

A similar discussion for DO loops.



Adrian Sandu 2001-08-26