Re: Good Use of GOTO

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> Lucius L. Hilley III wrote:
> > 
> > c.k.lester wrote:
> > > 
> > > Lucius L. Hilley III wrote:
> > > 
> > > > for t=1 to 10 next
> > > >   if a then
> > > >     goto "t_continue"
> > > >   else
> > > >     -- code
> > > >   end if
> > > >   label "t_continue"
> > > > end for
> > > 
> > > Good job, Lucius! :) This solidifies my opinion that GOTO is unnecessary.
> > > The example just using 'continue' is cleaner, and it's probably faster
> > > without GOTO (one less jump?).
> > 
> > We need goto to be able to jump out of a loop early.
> > Redundant if statements are such a pain.
> >   Lets add exit to avoid adding goto.
> > 
> > We want need goto to leap back to the beginning of a for
> > loop and keep the index value the same.  We are now trying
> > another approach, we changed something else.
> >   Lets add retry to avoid adding goto.
> > 
> > We want need goto in order to proceed through a loop without
> > executing any following code within the loop before starting
> > the next iteration.
> >   Lets add continue to avoid adding goto.
> > 
> > 
> > MORE keywords are CLEANER than one easy to understand KEYWORD?
> 
> In this case, yes. 
> 
> The main differenmce is that the 'goto' does not tell the code reader what the
> intentions of the original coder were. Whereas 'continue', 'exit', etc signal
> to the reader what the coder was attempting to achieve.

I gave code for that also. It involved:
goto exit
goto retry
goto restart
goto next
goto cleanup&return
etc.

The only way that's not clear is if you don't read english.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu