2006/5/18, Leslie Viljoen <leslieviljoen / gmail.com>: > On 5/18/06, DEBAUN, STEVE [AG-Contractor/2400] <steve.debaun / seminis.com> 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. When refactoring properly this is often easily solved with a "return" statement. > In Ruby I sometimes do similar things with Exceptions, since an > Exception a rather glorified goto-with-parameters. The best idiom for this in Ruby is catch throw (as opposed to raise and rescue). > 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. I would have to look at the link you provided - I cannot remember when I last used a GOTO (must have been in my ancient ZX Spectrum times) and I definitively never missed it after that. All modern languages have decent program flow control elements that make GOTO really superfluous IMHO. Kind regards robert PS: Steve, you got the rope yet? -- Have a look: http://www.flickr.com/photos/fussel-foto/