Skip to content

Instantly share code, notes, and snippets.

@eveadele
Created February 21, 2014 15:40
Show Gist options
  • Save eveadele/9136492 to your computer and use it in GitHub Desktop.
Save eveadele/9136492 to your computer and use it in GitHub Desktop.
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