From: Matma Rex Date: 2013-01-07T15:01:52+09:00 Subject: Re: ruby 1.9.3p362 ranges as conditions bug? On Mon, 07 Jan 2013 05:26:43 +0100, tamouse mailing lists wrote: > On Sun, Jan 6, 2013 at 9:09 PM, windwiny wrote: >> vs = (1..9).to_a >> => [1, 2, 3, 4, 5, 6, 7, 8, 9] >> >> v1 = vs.select { |n| if n==3..n==6 then 1 end } > > What do you expect n==3..n==6 to do? That evaluates to a range of > booleans, depending on the value of n: These are so-called flip-flops, and a valid though obscure feature of Ruby. Here's a nicer test case: irb(main):001:0> (1..100).each do |i| irb(main):002:1* puts i if i==42..i==45 irb(main):003:1> end 42 43 44 45 windwiny, I wasn't able to replicate your results on ruby 1.9.3p0 (2011-10-30) [i386-mingw32]. v1 and v3 both gave the same (first) result.