From: Nathan Smith Date: 2006-08-16T07:09:11+09:00 Subject: Re: goto function? On Wed, 16 Aug 2006, David Vallner wrote: > On Tue, 15 Aug 2006 23:05:10 +0200, fabsy wrote: > > I want the script to start over again.. for example.. > > When the user made an input and pressed return I want the script to > > "restart" or jump to the beginning.. > > > > Let me introduce you to my good friend: structured programming. I'm sure > you'll get along marvelous once you get to know each other. > > The BASIC construct of "goto" is rightfully considered harmful for > programs above a certain complexity. It's not present in Ruby in any > direct way that would let you jump around a program's structure > arbitrarily. (Actually, that's a lie, but I'll hold the continuations for > the sake of simplicity.) Obligatory response: In some very rare circumstances, using gotos does in fact have a rightful place in code. In very long switch/case statements in C code, a _very_ well structured (and properly named) set of labels/gotos can make code much cleaner, and easier to understand, than if they were not used. But I'll say again, this is very rare. Nate