title: Is the value of a Fortran DO loop counter variable guaranteed to be persistent after the loop ends?
body: <p>I often see Fortran code functionally similar to the excerpt below.  Had I written it, I would have used &quot;K&quot; instead of &quot;J&quot; in the write statement.  Using &quot;J&quot; gives the same results, but is that just luck, or is it an expected behavior based on Fortran rules?  I came up empty-handed searching for an applicable rule.</p>
  <pre><code>K = [arithmetic expression]
  do J = 1, K
    X(J) = [some function of J]       
  enddo
  write(*,*) 'Number of loops: ', J
  </code></pre>