Skip to content

Instantly share code, notes, and snippets.

@hchood
Created November 21, 2013 16:10
Show Gist options
  • Save hchood/7584553 to your computer and use it in GitHub Desktop.
Save hchood/7584553 to your computer and use it in GitHub Desktop.
Ruby Fundamentals IV: Ruby Data Structures Assignment (Game of Thrones characters)
# Ruby Fundamentals IV: Ruby Data Structures Assignment
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
character_list = []
characters.each do |char_name, char_house|
character = {name: char_name, house: char_house}
character_list << character
end
character_list.each {|char| puts "#{char[:name]} represents the #{char[:house]}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment