Help with array

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.

On Oct 18, 2010, at 4:29 PM, Matthew Boston wrote:

Thanks for the help.


Posted via http://www.ruby-forum.com/.

Rather than repeat it, just refer to this thread:
http://www.ruby-forum.com/topic/216796

-Rob

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs