Search code examples
fortran

Does the code following the end of a loop label execute in the loop


In this loop:

DO 180 J=1,9
K=9*(I-1)+J
180 ZX(K)=0.D0

How many times will (ZX(K)=0.D0 execute? Once or 9?


Solution

  • Answer: 9 times

    see https://docs.oracle.com/cd/E19957-01/805-4939/z400073d15115/index.html

    DO Loop Range

    The range of a DO loop consists of all of the executable statements that appear following the DO statement, up to and including the terminal statement.