NumRangeExtensions extension

Extension methods for num (and its subtypes like int, double).

on

Methods

forceInRange(num min, num max) num

Available on num, provided by the NumRangeExtensions extension

Returns the min if the number is less than min, max if greater than max, or the number itself otherwise.
isBetween(num from, num to) bool

Available on num, provided by the NumRangeExtensions extension

Returns true if this number is between from and to inclusive.
isInRange(num min, num max) bool

Available on num, provided by the NumRangeExtensions extension

Returns true if the number is between min and max inclusive.
isNotBetween(num from, num to) bool

Available on num, provided by the NumRangeExtensions extension

Returns true if this number is NOT between from and to inclusive.