Re: coding style: do/exit or do while ?



dpb wrote:

(snip regarding DO and WHILE loops)

And, of course, where amax and bmax are both external to the loop and
don't change (as I know they were postulated as constants here). But
oftentimes one will see the construction tried to be used where it
doesn't fit when one of the conditions is changing based on loop
execution and the test then is misplaced in the logic flow. Avoiding
this, I presume, is the prime reason for the proscription although I'm
fond of the "never say 'never' " dictum.

For those converting C to Fortran, the test in a C for loop is done
using the current values, and they can change. One should be careful:

for(i=1;i<=n;i++)

n can legally change inside the loop, and so might not translate to a
Fortran DO loop.

-- glen



.