On Sep 6, 2007, at 12:00 PM, Martin Jansson wrote:

> irb(main):002:0> i=1
> => 1
> irb(main):003:0> until (i+=1)>5
> irb(main):004:1> p i
> irb(main):005:1> end
> 2
> 3
> 4
> 5
> => nil
> irb(main):006:0> RUBY_VERSION
> => "1.8.3"
>
> The condition is evaluated before the first iteration.
>
> At least it's consistent:
>
> irb(main):005:0> i = 1
> => 1
> irb(main):006:0> p i until (i+=1)>5
> 2
> 3
> 4
> 5
> => nil
>
> I think it makes "until" less useful. Why would anyone want this?


	If you want a bottom tested loop then do it this way:

irb(main):006:0> i=1
=> 1
irb(main):007:0> begin
irb(main):008:1* p i
irb(main):009:1> end until (i+=1) > 5
1
2
3
4
5
=> nil
irb(main):010:0>

Cheers-

-- Ezra Zygmuntowicz 
-- Founder & Ruby Hacker
-- ez / engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)