From: Jacob Fugal Date: 2005-12-14T01:09:51+09:00 Subject: Re: Idiom wanted: do-while On 12/12/05, Steve Litt wrote: > On Monday 12 December 2005 05:42 pm, James Edward Gray II wrote: > > loop do > > # ... some action ... > > break unless ... > > end > > I do this quite a bit, but it's not structured programming and is a little > like a goto. I see no similarity. 'goto' is unstructured because the target point is completely arbitrary; place a label in your code then jump right to it. 'break' is completely structured; it's part of the structure of the enclosing loop and its target is defined by that structure. > Break can improve readability on small loops, but on large loops > maintained by multiple people it can become a nightmare. I agree with James; if the loop is long enough or complex enough for these to be a problem, the body of the loop probably needs some serious refactoring. Jacob Fugal