From: Wayne Conrad Date: 2001-10-22T13:58:35+09:00 Subject: [ruby-talk:22931] Re: Possible RCR? - break for nested loops On Sun, 21 October 2001, Phil Tomson wrote: > x.times do > LABLE:y.times do > z.times do > if (somecondition) break LABLE > end > end > end > > But, I'm not sure it has advantages over catch/throw which is already > available. Right. That's almost exactly the Java syntax for labeled break, and it's not significantly better than catch/throw for readability. The only way a labeled break makes things more readable is if the label goes AFTER the loop so that it's easy for the eye to pick out where the break will go to. It's very odd to have to look *up* to find out where a break that makes a loop fall out the *bottom* is going to go. So instead: x.times do y.times do z.times do if (somecondition) break LABEL end end LABEL: end Wayne Conrad