Answer

You should have discovered that Fortran won't let you modify the loop variable (in this case I). While you can modify the control variables (FIRST, LAST, and STEP), the modifications have absolutely no effect on the behavior of the loop. The sequence of values that the loop variable will take on is determined before the loop executes its first iteration. In plain words, this is what the complicated-looking mathematics in section 5.2 of the book mean.

Return to lesson.



Hamlet Project
hamlet@cs.utah.edu