Clamp
Clamps a number within the inclusive lower and upper bounds.
| Category | Numbers |
| Author | Pol Gubau |
| Since | 1.0.0 |
| Last Updated | 2025-03-15 |
| Type | Sync |
| Compatibility | Universal |
Example
Input
clamp(10, 5, 15)Output:
10
Return
Returns the clamped number within the specified bounds.
Type: number
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| value | number | null | Yes | The number to clamp. |
| minimum | number | null | No | The minimum bound to clamp the number. |
| maximum | number | null | Yes | The maximum bound to clamp the number. |
Notes
If only one bound is provided, it returns the minimum of the value and the bound.
Tags
- number
- clamp
- bounds
- math