Runtime v2.81 · Updated Sep 30, 2026

clamp

Clamp value into the min -> max range.

Syntax

clamp(value, min, max, /)

Parameters

NameDescription
valueInt | Float
Input value
Required · Positional only
No default
minInt | Float
Lower bound
Required · Positional only
No default
maxInt | Float
Upper bound
Required · Positional only
No default

Returns

Float — Clamped numeric value.

Behavior / side effects

Clamp value into the min -> max range.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

safe = clamp(135, 0, 100)
text(str(safe))

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

None