Re: dumb question #1 re: DO loops



*** Russell <richard.russell@xxxxxxxxxxx> wrote:

> You have it right. In current Fortran, an exit from the loop would be:
> IF(ID(J).LT.0) EXIT

And while it isn't directly relevant to the OP's current task, let me
just note that the corresponding "current" way to continue the loop is

if (id(j)<0) cycle

or, even better, in my personal opinion,

if (id(j)<0) cycle the_do_loop

where the_do_loop is some suitably descriptive name given to the loop.
My personal style is to always use a label with cycle or exit statements
in order to make it explicit and clear what is being cycled or exited.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.


Quantcast