Skip to content

Instantly share code, notes, and snippets.

@meineerde
Created January 12, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meineerde/c9d7371c9613eefb2be5 to your computer and use it in GitHub Desktop.
Save meineerde/c9d7371c9613eefb2be5 to your computer and use it in GitHub Desktop.
ruby-colearning-warmup
#!/usr/bin/env ruby
KNOWLEDGE = {
"gustavo" => ["learing ruby", "drinking beer", "sitting at the Spree"],
"duilio" => ["teaching ruby", "sunbathing", "doing stuff"],
"max" => ["eating great food", "another thing", "a third"]
}
def get_knowledge(person)
favorite_things = KNOWLEDGE[person]
puts "#{person.capitalize}'s favorite things to do are: #{favorite_things.join(', ')}"
end
person = nil
until person
print "About whom do you want to know something? Gustavo, Duilio, or Max? "
person = gets.chomp.downcase
if KNOWLEDGE.key?(person)
get_knowledge(person)
else
puts "Unknown person. Please try again..."
person = nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment