isBetween method

bool isBetween(
  1. int lower,
  2. int upper
)

A utility method to check if the current integer is within a specified range.

Takes lower as the lower bound and upper as the upper bound. Returns true if the current integer is within the bounds, inclusive.

Implementation

bool isBetween(int lower, int upper) => this >= lower && this <= upper;