Created
January 12, 2015 18:44
-
-
Save meineerde/c9d7371c9613eefb2be5 to your computer and use it in GitHub Desktop.
ruby-colearning-warmup
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
#!/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