# Math.clamp ## Function Scope restrictions. Returns min if value is less than min, returns max if greater than max, otherwise returns value. ## Syntax ```bt Math.clamp(value, min, max) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | value | Number | Yes | None | The number to be restricted. | | min | Number | Yes | None | Minimum value. | | max | Number | Yes | None | The maximum value. | ## Return value | Type | Description | | ------ | ------ | | Int/Float | Returns min if value is less than min, returns max if greater than max, otherwise returns value. An Int is returned for integer results, and a Float for non-integer or non-finite results. | ## Example ```bt result = Math.clamp(120, 0, 100) // Output: 100 print result ``` ## Notes - An error will be reported if min is greater than max.