From: Robert Klemme Date: 2013-02-23T23:30:07+09:00 Subject: Re: range is not assigning to the splat variable. On Sat, Feb 23, 2013 at 2:00 PM, Bartosz DziewoƄski wrote: > On Sat, 23 Feb 2013 13:44:25 +0100, Matthew Kerwin > wrote: > >> I know, I know. I wasn't paying attention while typing and didn't realise >> how bad it was. I edited the post immediately on the forum interface, but >> apparently the mailing list version got sent first. >> >> I think it now says something like "Splat is an array operation, Range is >> not an array." > > > But you can splat a range? > > irb(main):004:0> a, b, c = *0..2 > => [0, 1, 2] > irb(main):005:0> a > => 0 > irb(main):006:0> b > => 1 > irb(main):007:0> c > => 2 > > Are we misunderstanding each other? You created an explicit implicit Array conversion by using "*" on the right side. The point Matthew and I were trying to make is that you cannot do the same with a range without the splat operator on the right side: irb(main):004:0> a, b, c = 0..2 => 0..2 irb(main):005:0> a => 0..2 irb(main):006:0> b => nil irb(main):007:0> c => nil Whereas with an Array you can: irb(main):012:0> a, b, c = [0, 1, 2] => [0, 1, 2] irb(main):013:0> a => 0 irb(main):014:0> b => 1 irb(main):015:0> c => 2 Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/