Skip to content

Instantly share code, notes, and snippets.

@kbberker
Last active November 15, 2018 10:11
Show Gist options
  • Save kbberker/76b274a4ef39faf6b92fb38873715392 to your computer and use it in GitHub Desktop.
Save kbberker/76b274a4ef39faf6b92fb38873715392 to your computer and use it in GitHub Desktop.
Hash of wizards
wizards = {
"Harry" =>{
:full_name => "Harry James Potter",
:age => 12,
:hair_colour => "brown",
:favourite_class => "Defence Against the Dark Arts"
},
"Ron" =>{
:full_name => "Ronald Bilius Weasley",
:age => 11,
:hair_colour => "ginger",
:favourite_class => nil
},
"Hermione" =>{
:full_name => "Hermione Jean Granger",
:age => 11,
:hair_colour => "brown",
:favourite_class => "Everything"
}
}
wizards["Harry"]
# => {:full_name=>"Harry James Potter", :age=>12, :hair_colour=>"brown", :favourite_class=>"Defence Against the Dark Arts"}
wizards["Harry"][:age]
#=> 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment