John Venier writes:
> Here's a method without dummy induction variables:
>
> BLOCK_LABEL: DO
>
> ...
>
> EXIT BLOCK_LABEL
> END DO BLOCK_LABEL
>
> Still less than elegant ...
I've seen that one suggested before. (I think one of the F folk once
suggested that this could be used to replace all the gotos I ever use;
it could - but I decided I liked the gotos better). It has the
additional problem that it is extremely prone to a serious error.
Accidentally omit or delete the EXIT statement and this turns into an
infinite loop. I could see this as happening pretty easily, partly as
a result of the confusing use of a looping construct where no actual
loop was intended. Somehow, I find it easy to imagine some future
maintainer seeing that "EXIT BLOCK_LABEL" and concluding that it was
superfluous because it was already at the end of the block. As long
as you remember that its a loop, the exit makes sense there, but once
you slip into thinking of it as just how one writes blocks, I can see
the exit as being misunderstood.
I figured this was more confusing and error-prone than my gotos.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|