Learn Ruby
Range
8.3
Lesson

include? to find if value is in the range

Range has method include? which can be used to find if a value is in a given range or not.

Let’s find out if value 45 is within range 30 to 50.

Now let’s check if value 80 is within range 20 to 40.