Skip to content

Instantly share code, notes, and snippets.

@gabericharde
Created September 1, 2016 18:12
Show Gist options
  • Save gabericharde/38cb164ccfdd65afcf7340cf248193cb to your computer and use it in GitHub Desktop.
Save gabericharde/38cb164ccfdd65afcf7340cf248193cb to your computer and use it in GitHub Desktop.
hash = {a: 10, b: 20, c: 30}
hash.each {|key| puts key}
# for the output of this, i'm getting:
# a
# 10
# b
# 20
# c
# 30
# all the documentation i have looked at suggests i should just be getting keys
# also used old school nasty hash:
grandpa_hash = { "a" => 10, "b" => 20, "c" => 30 }
# but i still get the same result with grandpa_hash.each {|key| puts key}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment