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

Is this greater than or equal to from and less than or equal to to?
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

Is NOT this greater than or equal to from and less than or equal to to?