Created
June 30, 2012 23:53
-
-
Save kmandreza/3026080 to your computer and use it in GitHub Desktop.
Mood
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
def smiley(input) | |
if input[:mood] == "happy" #mood is the key, it also has to be a string | |
return ":)" | |
elsif input[:mood] == "sad" | |
return ":(" | |
else | |
return ":|" | |
end | |
end | |
h1 = {:mood => "happy"} | |
h2 = {:mood => "sad"} | |
h3 = {:mood => "sentimental"} | |
puts smiley(h2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment