PROGRAM nested_loops

!-- example using named, nested, non-indexed do loops

  IMPLICIT NONE
  INTEGER :: i, j

  i = 0; j = 0
  outer: DO
    i = i+1
    inner: DO 
      j = j+1
      PRINT*, "i is", i," j is", j
      IF (i >= 5 .or. j >= 5) exit outer
      IF (i == 2 .or. j == 4) cycle outer
      IF (i == 3 .and. j == 3) exit inner
    enddo inner
  enddo outer
  print*, "Loop finished.  I now equals", i

END PROGRAM nested_loops
