> So why should I put a CONTINUE here?
> program ending
> character *10 a
>
> do
> read (*,*,end=99)a
> print *,a
> end do
>
> 99 end program ending
>
Practical reason: because at some point someone who inherited the
routine from you (let's make it a subroutine instead of a program) wants
to find out why his program doesn't work, and if it's because the 'read'
fails. So he needs:
99 continue
print*, "End of input in subroutine ENDING"
end subroutine ending
Philosophical reason: In Fortran, one statement should occupy one line
and do one thing. Take control after a GOTO, for example. The 'practical
reason' is part of this: it's easier to add functionality later.
Herbert
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|