On May 18, 2006, at 1:48 PM, Leslie Viljoen wrote: > 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. This is what the return keyword is for. > In Ruby I sometimes do similar things with Exceptions, since an > Exception a rather glorified goto-with-parameters. Yuck. Just use return. > 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. -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com