From: "Ara.T.Howard" Date: 2005-07-22T10:50:56+09:00 Subject: Re: Odd Array#[x..y] return values On Fri, 22 Jul 2005, Daniel Berger wrote: > Hi all, > > Ruby 1.8.2 > > Consider: > > irb(main):001:0> a = [] > => [] > irb(main):002:0> a[0..1] > => [] start at a legitimate index and continue with every possible index until the end, not matter where that is > irb(main):003:0> a[-2..-1] > => nil start at a illegitimate index and return that there cannot be anything after this - ergo 'nil' > Why does the first return [] and the second return nil? or at least that makes sense to me... cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================