Skip to content

Instantly share code, notes, and snippets.

@jmoon90
Last active December 29, 2015 00:19
Show Gist options
  • Select an option

  • Save jmoon90/7584561 to your computer and use it in GitHub Desktop.

Select an option

Save jmoon90/7584561 to your computer and use it in GitHub Desktop.
Quick Challenge: Using what you know about arrays and through searching online with your review pair, write a small program for the hash supplied above that outputs the lines below. Write the program in a way where we could easily add more characters to the list and include them in the output.
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
characters.each do |name,house|
puts "#{name} represents the #{house}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment