You're using the shorthand for "slice" on the array class.

Ruby docs have some more examples that may help you to work out why it
behaves like it does...
http://www.ruby-doc.org/core-2.1.4/Array.html#method-i-5B-5D

On Thu, Nov 13, 2014 at 4:52 PM, leam hall <leamhall / gmail.com> wrote:

> Working through the Ruby koans and came up with a question.
>
> With:
>   array = [:peanut, :butter, :and, :jelly]
>
> Then this yeilds true:
>   assert_equal [], array[4,0]
>
> But so does this:
>   assert_equal nil, array[5,0]
>
> Why is [4,0] and empty array and [5,0] nil?
>
> Leam
> --
> Mind on a Mission
>



-- 
George Drummond
Software Engineer

+44 (0)333 240 2222


[image: Rentify]
 6-8 Long Lane, London EC1A 9HF
 www.rentify.com