Created
February 5, 2009 23:03
-
-
Save Farzy/59081 to your computer and use it in GitHub Desktop.
Comparing Ruby 1.8 and Ruby 1.9's hash ordering
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
% irb1.8 | |
>> h = Hash.new | |
=> {} | |
>> 10.times { |i| h[i] = i*10 } | |
=> 10 | |
>> h | |
=> {5=>50, 0=>0, 6=>60, 1=>10, 7=>70, 2=>20, 8=>80, 3=>30, 9=>90, 4=>40} |
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
% irb1.9 | |
>> h = Hash.new | |
=> {} | |
>> 10.times { |i| h[i] = i*10 } | |
=> 10 | |
>> h | |
=> {0=>0, 1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 6=>60, 7=>70, 8=>80, 9=>90} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment