You are viewing a single comment's thread. Return to all comments →
To check if a is within the range b to c, use the between? method:
a.between?(b, c)
Or, if you want to explicitly return the result from a method:
return a.between?(b, c)
This will return true if a is between b and c (inclusive), otherwise false.
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby Tutorial - Object Method Parameters
You are viewing a single comment's thread. Return to all comments →
To check if a is within the range b to c, use the between? method:
a.between?(b, c)
Or, if you want to explicitly return the result from a method:
return a.between?(b, c)
This will return true if a is between b and c (inclusive), otherwise false.