Function: Clamp
Function: Clamp

Function: Clamp

Clamp ( VALUE, MIN, MAX )

Returns a value clamped to a range that is between two values.


Parameter Type Description
VALUE VALUE The input value.
MIN VALUE The lower bound value.
MAX VALUE The upper bound value.


VALUE The resultant value.

What It Does

This function returns a value clamped within the provided range - if the input value is comparatively less than the lower bound, the lower bound is returned, and if it is greater than the upper bound, the upper bound is returned. The value itself is returned if it is greater than or equal to the lower bound, and less than or equal to the upper bound.

See Also

Min — Returns the lesser of two values.
Max — Returns the greater of two values.

Additional Technical Notes

Strings are compared lexicographically, which is character-order (not alphabetical). The sorting is based on the character values, not any kind of locale-based or linguistic significance.


Modal Header