Re: Good Use of GOTO
- Posted by Derek Parnell <ddparnell at bigpo?d.co?> Jun 06, 2008
- 808 views
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. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell