From: Brian Mitchell Date: 2005-12-13T08:53:19+09:00 Subject: Re: Idiom wanted: do-while On 12/12/05, ara.t.howard@noaa.gov wrote: > harp:~ > cat a.rb > i = 0 > > ( > p i > i += 1 > ) while i < 3 > > > harp:~ > ruby a.rb > 0 > 1 > 2 Not quite. That is just a while loop: ( puts "foo" ) while nil .. nil which is as always, equivalent to: while nil puts "foo" end If you really need a do while loop it is not hard to use loop to accomplish what you need. If you want something more complex you could easily get this to work: lambda do ... end.while { ... } All you would need is something like this: class Proc def while loop do result = call return result unless yield end end end I am sure there is plenty of room for improving this example too. Brian.