Re: goto considered essential

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

Matt Lewis wrote:
> 
> Jason Gade wrote:
> > 
> > The one instance where I can see goto being useful is where you have several
> > conditions or loops and they all have to jump to the same point on an
> > exception.
> > 
> 
> Another instance is when porting code from other languages (like C) that uses
> them.  It would save having to re-engineer the program flow, and adding extra
> flags to the code to simulate fall through in case statements.
> 
> Matt Lewis

I forgot about fall through in case statements!

But yeah, I was going to try to port rogue to Euphoria several years ago and I
got stumped on a part that used a goto. Basically it checked a condition and then
either started at the beginning of the game loop or jumped into the middle of it.
I couldn't figure out how to do it without writing a section of code twice.

Someone gave me the answer, it's here in the message archive somewhere.

I never did finish porting that program...


--
"The author regrets that he is unable to reconcile himself to the
thoughtful point of view you have expressed. However, it must be kept
in mind that being raised in different cultures and different places can
result in such differences of viewpoint between individuals.
The author is from planet Earth." [author unknown]

j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu