Created
November 21, 2013 16:10
-
-
Save hchood/7584553 to your computer and use it in GitHub Desktop.
Ruby Fundamentals IV: Ruby Data Structures Assignment (Game of Thrones characters)
This file contains hidden or 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
# 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