Re: Good Use of GOTO
- Posted by c.k.lester <euphoric at cklest?r.c?m> Jun 06, 2008
- 855 views
Kat wrote: > c.k.lester wrote: > > Michael J. Sabal wrote: > > > c.k.lester wrote: > > > > continue, exit, retry, etc... > > > I thought the whole point of introducing GOTO was so as not to litter the > > > language with all these extra keywords. > > GOTO is a poor substitute for these other words. > > > > for t=1 to 10 next > > if a then > > continue > > else > > -- code > > end if > > end for > > > > In the above very simple example, which nobody should ever use but it is > > analogous to something more complicated, the continue tells the interpreter > > to resume the loop... meaning, it knows to increment t then goto the top and > > resume execution. > > Continue where? Continue says, "Continue the loop at the next iteration." GOTO says nothing comprehensible. In cases where you have imbedded loops, I would hope one could make use of the loop var... for a=1 to z do for b=a to y do if x then continue b -- early loop iteration else continue a -- early loop iteration end if end for -- regular loop iteration > > In the example above, no matter where you GOTO, your loop var will not > > increment... without extra [cumbersome] code. > > OMG, you mean like: > > t += 1 > or > t -= 1 > > How horrific! Hey, we agree on something!