clamp(x: number, lo: number, hi: number) → f64

Category: [math](builtinsmath)_

Constrain x to the range [lo, hi].

ParameterTypeDescriptionRemarks
xnumberThe value to clamp.
lonumberThe lower bound.
hinumberThe upper bound.
returnsf64x limited to [lo, hi], as an f64.
wcl
clamp(12.0, 0.0, 10.0)   // constrain the value into [0, 10] → 10.0