Skip to content

Instantly share code, notes, and snippets.

@siakaramalegos
Created July 29, 2015 13:49
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 siakaramalegos/838c7ca6e4afb5549104 to your computer and use it in GitHub Desktop.
Save siakaramalegos/838c7ca6e4afb5549104 to your computer and use it in GitHub Desktop.
def activity
puts "What's the temperature today?"
temperature = gets.chomp.to_i
# if temperature > 105 || temperature < 0
# puts "That's not a valid temperature for New Orleans."
# activity
# elsif temperature > 80
# puts "It's #{temperature} degrees. Let's go swimming!"
# elsif temperature > 50
# puts "Let's go hiking!"
# else
# puts "Let's read a book"
# end
# Inclusive: (a..b) is like a <= x <=b
# Exclusive of end value: (a...b) is like a <= x < b
case temperature
when 80..105
puts "Let's go swimming!"
when 50...80
puts "Let's go hiking!"
when 0...50
puts "Let's read a book"
else
puts "What planet are you on?"
activity
end
end
activity
# Boolean operators:
# >
# <
# >=
# <=
# ==
# !=
# &&
# ||
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment