Could someone please explain what I am (obviously) missing here?
Because [5,0] is out of array boundary.
matz.
But a[4] = nil ( it’s a 4-element Array), so isn’t a[4,0] also out of the
boundary?
Yes, but 5 is RIGHT out.
Sorry if I’m being thick here.
I don’t think you’re being thick… it’s one of
those “gotchas” in my opinion.
The explanation (which I can’t recall or repeat)
has to do with imagining that there is a “cursor”
that doesn’t point AT array elements, but at the
points IN BETWEEN them. (I seem to recall that
Emacs encourages this kind of thinking.)
Someone else can explain better.
Hal
···
----- Original Message -----
From: “Barry Shultz” barry_sh@hotmail.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, February 06, 2003 3:10 AM
Subject: Re: empty Array returned but expect nil