From: Leslie Viljoen Date: 2006-05-19T17:47:44+09:00 Subject: Re: How to "go to" in a RUBY script . . . On 5/18/06, Eric Hodel wrote: > On May 18, 2006, at 1:48 PM, Leslie Viljoen wrote: > > > On 5/18/06, DEBAUN, STEVE [AG-Contractor/2400] > > wrote: > >> To everyone else: > >> I'll distract him, while y'all get a rope. > > > > hehe. I recently noticed that C# still has a goto, although it seems > > that you can't have a label right at the end of a function since the > > label must precede an actual statement. I found it to be useful in a > > case where I was deep in nested loops, searching for a string and had > > just found it, so I needed to jump out. It seemed so much clearer and > > simpler to use the goto rather than have > > > > if (... & flag_variable) > > > > in every loop condition., even though I had to put silly nop > > statements at the end of the functions. > > This is what the return keyword is for. You are right, return works well there. > > I think the great fear of having spaghetti code resulted in a bit of > > an over-reaction: the universal condemnation of goto. Goto is still > > sometimes simple and useful. > > Abusing exceptions the way you describe sounds just as horrible. The code is long but I'll strip it down and let you have a look. Maybe you can suggest a better way then. Les