An irb
session is following:
>> ar = [:peanute, :butter, :and, :jelly]
=> [:p开发者_开发问答eanute, :butter, :and, :jelly]
>> ar[0, 1]
=> [:peanute]
>> ar[4, 1]
=> []
>> ar[5, 1]
=> nil
Why ar[4, 1] does not return nil
just like ar[5, 1]? Would someone explain this behaviour?
This is mentioned in the documentation as a special case.
精彩评论