Ruby Tutorial - Object Method Parameters

  • + 0 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.