From: Robert Klemme Date: 2009-12-13T20:27:56+09:00 Subject: Re: human-readable listing of array elements On 10.12.2009 18:48, Aldric Giacomoni wrote: > Robert Klemme wrote: >> 2009/12/10 Aldric Giacomoni: >>> Marnen Laibow-Koser wrote: >>>> >>>> Yes. �case won't handle<= conditions AFAIK. >>> >>> That is a very good point, though it does handle ranges, so "case 0..1" >>> would fit this particular scenario. >>> Your elsif statement is probably better suited here though. >> >> That point is not exactly true: while it doesn't out of the box... > > c:\>irb > irb(main):001:0> RUBY_VERSION > => "1.8.7" > irb(main):002:0> 5.times { |a| case a; when 0..2 then puts "yow" else > puts "nah" end } > yow > yow > yow > nah > nah > => 5 > irb(main):003:0> > > Alright.. Well then, I'm confused. My comment referred to the "won't handle <=" part. I demonstrated how it can be made to handle less than comparisons directly, i.e. without using ranges which is not exactly the same operation. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/