Created
February 21, 2014 15:40
-
-
Save eveadele/9136492 to your computer and use it in GitHub Desktop.
This file contains 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
name = "" | |
characters = {} | |
def add_name | |
puts "What name would you like to add?" | |
name = gets.chomp | |
return name | |
end | |
def add_house(hash, name) | |
puts "What house does this person represent?" | |
house = gets.chomp | |
hash[name] = house | |
end | |
def print_names(hash) | |
hash.each do |key, value| | |
puts "#{key} represents the #{value}" | |
end | |
end | |
while true | |
name = add_name | |
break if name == "done" | |
add_house(characters, name) | |
end | |
print_names(characters) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment