boundNumber()function

boundNumber(num: number, min: number, max: number): number
ParamType
numnumber
The number to bound. required
minnumber
The minimum bound, inclusive. required
maxnumber
The maximum bound, inclusive. required
Return
number
num clamped to lie between min and max.
Throws
unknown
ValueError if max is less than min.

Bound a number between two values.

  • e.g. 12 bounded by 2 and 8 is 8

Examples

boundNumber(12, 2, 8) // 8