Clamps a numeric value within a specified range.
Ensures that the given value falls between the minimum and maximum bounds. If the value is less than the minimum, returns the minimum. If the value is greater than the maximum, returns the maximum. Otherwise, returns the original value unchanged.
The minimum allowed value (inclusive)
The value to clamp
The maximum allowed value (inclusive)
The clamped value within the range [min, max]
minmax(0, -5, 10); // Returns 0minmax(0, 5, 10); // Returns 5minmax(0, 15, 10); // Returns 10 Copy
minmax(0, -5, 10); // Returns 0minmax(0, 5, 10); // Returns 5minmax(0, 15, 10); // Returns 10
Clamps a numeric value within a specified range.
Ensures that the given value falls between the minimum and maximum bounds. If the value is less than the minimum, returns the minimum. If the value is greater than the maximum, returns the maximum. Otherwise, returns the original value unchanged.