Skip to content

Instantly share code, notes, and snippets.

@langsharpe
Created March 2, 2011 11:21
Show Gist options
  • Save langsharpe/850791 to your computer and use it in GitHub Desktop.
Save langsharpe/850791 to your computer and use it in GitHub Desktop.
Undefined array index in Ruby
a = Array.new
a[2] = 'two'
a[4] = 'four'
puts a[5]
lang@virtualbox1:~/arrays$ ruby array3.rb
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment