Skip to content

Instantly share code, notes, and snippets.

@joegiralt
Created June 10, 2013 22:13
Show Gist options
  • Save joegiralt/5752880 to your computer and use it in GitHub Desktop.
Save joegiralt/5752880 to your computer and use it in GitHub Desktop.
tempaturebot
# Temperature bot is American but takes Celsius temperatures.
#
def temperature_bot(temp)
case temp
when temp <= 21 && 18 <= temp
"I like this temperature"
else
"This is uncomfortable for me"
end
end
temperature_bot(18)
#=> "I like this temperature"
temperature_bot(21)
#=> "I like this temperature"
temperature_bot(22)
#=> "This is uncomfortable for me"
temperature_bot(-3)
#=> "This is uncomfortable for me"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment