Empty Array returned but expect nil

Hello,
I do not understand why a[4,0] below returns [], whereas a[5,0]
returns nil (which is what I would expect for a[4,0] as well).
Could someone please explain what I am (obviously) missing here?

Thanks,
Barry

8<----------8<----------------------------
ruby -v
ruby 1.6.7 (2002-03-01) [i586-mswin32]

c:>irb
irb(main):001:0> a = [1,2,3,4]
[1, 2, 3, 4]
irb(main):002:0> a[4]
nil
irb(main):003:0> a[4,0]
[]
irb(main):004:0> a[5,0]
nil

···

MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

Hi,

···

In message “empty Array returned but expect nil” on 03/02/06, “Barry Shultz” barry_sh@hotmail.com writes:

I do not understand why a[4,0] below returns , whereas a[5,0]
returns nil (which is what I would expect for a[4,0] as well).
Could someone please explain what I am (obviously) missing here?

Because [5,0] is out of array boundary.

						matz.