use exculsive ranges in case statements : case « Statement « Ruby
- Ruby
- Statement
- case
use exculsive ranges in case statements
temperature = 76
case temperature
when 0...65
puts "Too cold!"
when 85...120
puts "Too hot!"
when 65...85
puts "Picnic time!"
else
puts "Temperature out of reasonable range!"
end
Related examples in the same category