Created
March 2, 2011 10:01
-
-
Save langsharpe/850719 to your computer and use it in GitHub Desktop.
Ruby example of array order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = Array.new | |
a[1] = 'one' | |
a[0] = 'zero' | |
a.each do |value| | |
puts value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lang@virtualbox1:~/arrays$ ruby array.rb | |
zero | |
one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment