For the complete documentation index, see llms.txt. This page is also available as Markdown.

math.clamp

clamp(value, min, max): number

Clamps a value so it never leaves the given range.

Parameters

value

number

The value to clamp.

min

number

The lowest value the result can be.

max

number

The highest value the result can be.

Returns

number

The value, limited to the range between min and max.

Example

Last updated