Skip to main content

Math: Clamp

Restrict a number to a [min, max] range. Bounds can be supplied either statically via the Min / Max parameters or dynamically via the same-named input connectors. The connector wins when both are set. Both bounds must be provided one way or the other: if a bound's input connector is unwired and the corresponding parameter is empty, the step fails. The step also fails when Min is greater than Max, or when any input is not a Number.

Example
Min: 0, Max: 10
Input: -3 → Output: 0
Input: 5 → Output: 5
Input: 20 → Output: 10

Parameters

Min

Static lower bound. Used when the min input connector is unwired. Setting it makes the Min input optional; leaving it empty makes the Min input required.

Max

Static upper bound. Used when the max input connector is unwired. Setting it makes the Max input optional; leaving it empty makes the Max input required.

Input

Numberrequired
The value to clamp.
Minrequired

Dynamic lower bound — overrides the Min parameter when wired. Required unless the Min parameter is set; if both are missing, the step fails.

Maxrequired

Dynamic upper bound — overrides the Max parameter when wired. Required unless the Max parameter is set; if both are missing, the step fails.

Output

Result
The clamped value.