Skip to content

Instantly share code, notes, and snippets.

@stevenabrooks
Last active December 18, 2015 08:18
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 stevenabrooks/5752519 to your computer and use it in GitHub Desktop.
Save stevenabrooks/5752519 to your computer and use it in GitHub Desktop.
# Temperature bot is American but takes Celsius temperatures.
#
def temperature_bot(temp)
case temp
when temp = 18..22
"I like this temperature"
else
"This is uncomfortable for me"
end
end
puts temperature_bot(18)
puts temperature_bot(21)
puts temperature_bot(22)
puts temperature_bot(-3)
# 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