For basic looping, Fortran provides a flexible construct called the do-loop:

Specifying the loop_increment is optional, and it may be omitted if equal to 1. If loop_increment is present, it may be positive or negative (for counting down). Here are examples with different increments:

To go along with its simple do-loop, Fortran provides a do-while construct, allowing for more complex exit conditions.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement