clamp(x: number, lo: number, hi: number) → f64
Category: [math](builtinsmath)_
Constrain x to the range [lo, hi].
| Parameter | Type | Description | Remarks |
|---|---|---|---|
| x | number | The value to clamp. | — |
| lo | number | The lower bound. | — |
| hi | number | The upper bound. | — |
| returns | f64 | x limited to [lo, hi], as an f64. | — |
wcl
clamp(12.0, 0.0, 10.0) // constrain the value into [0, 10] → 10.0