Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ruby-1.9.2-p290 :001 > array = [:peanut, :butter, :and, :jelly]
  2.  => [:peanut, :butter, :and, :jelly]
  3. ruby-1.9.2-p290 :002 > array[4] # makes sense -- 4 is out of range
  4.  => nil
  5. ruby-1.9.2-p290 :003 > array[5,0] # makes sense -- 5 is out of range
  6.  => nil
  7. ruby-1.9.2-p290 :004 > array[4,0] # doesn't make sense -- 4 is still out of range...
  8.  => []