From: Hal Fulton Date: 2003-11-12T07:09:30+09:00 Subject: Re: Array#slice oddity... Matthew Berg wrote: > Another thing I noticed is that this behaviour is only exhibited if the > start index is 0: > > irb(main):004:0> a[0,1] > => [] > irb(main):005:0> a[1,2] > => nil > > The same thing happens with ranges: > > irb(main):006:0> a[0..1] > => [] > irb(main):007:0> a[1..2] > => nil I think it depends on how far off the end of the array you go. x = [1,2,3] x[3,3] # [] x[4,4] # nil There's a kind of logic to it, but it requires long and hard thought (for me, anyway). Search the archives. Hal