Ruby range: operators in case statement
It should just work like you said. The below case
construct includes the value 500.
case my_number
# between 100 and 500
when 100..500
puts "Correct, do something"
end
So:
case 500
when 100..500
puts "Yep"
end
will return Yep
Or would you like to perform a separate action if the value is exactly 500?
when -Float::INFINITY..0
Would do the trick :)