Skip to content

Instantly share code, notes, and snippets.

@langsharpe
Created March 2, 2011 10:43
Show Gist options
  • Save langsharpe/850759 to your computer and use it in GitHub Desktop.
Save langsharpe/850759 to your computer and use it in GitHub Desktop.
Ruby example of a holey array
a = Array.new
a[2] = 'two'
a[4] = 'four'
a.each do |value|
puts value
end
lang@virtualbox1:~/arrays$ ruby array.rb
nil
nil
two
nil
four
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment