Skip to content

Instantly share code, notes, and snippets.

@kmandreza
Created June 30, 2012 23:53
Show Gist options
  • Save kmandreza/3026080 to your computer and use it in GitHub Desktop.
Save kmandreza/3026080 to your computer and use it in GitHub Desktop.
Mood
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