next up previous
Next: Code Up: CS101 Lecture 10 Previous: Sample Problem using 2-D

Implied Do loops

For convenience, Fortran offers in some contexts (such as read, write) an IMPLIED DO loop.

Best illustrated with examples.

  Do I = 1, 5                           Do I = 1, 5
     Do J = 1, 5
      Write (*,*) A(I,J)                  Write (*,*) (A(I,J), J = 1,5)
     End Do
  End Do                                 End Do
The right hand side is an IMPLIED Do loop.

Every Write statement uses 1 line (similarly READ).

So, left code writes 25 lines (1 number per line). Right side code writes 5 lines (1 row per line!). More in Pass 2!



G. Sivakumar 2000-08-23