I'm working through the rubykoans and I cannot figure out one of them.
array = [1, 2, 3, 4]
Why does array[4,0] return [] but array[5,0] return nil?
From RDoc:
Returns nil if the index (or starting index) are out of range.
That means array[4,0] would return nil, right?
Thanks for the help.
···
--
Posted via http://www.ruby-forum.com/.
Rather than repeat it, just refer to this thread:
Arraystrange behaviour - Ruby - Ruby-Forum
-Rob
Rob Biedenharn
Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/
rab@GaslightSoftware.com http://GaslightSoftware.com/
···
On Oct 18, 2010, at 4:29 PM, Matthew Boston wrote:
I'm working through the rubykoans and I cannot figure out one of them.
array = [1, 2, 3, 4]
Why does array[4,0] return but array[5,0] return nil?
From RDoc:
Returns nil if the index (or starting index) are out of range.
That means array[4,0] would return nil, right?
Thanks for the help.
--
Posted via http://www.ruby-forum.com/\.