SplitScript reference / Numeric / clamp
Numeric.clamp
Method
T.clamp(minimum: T, maximum: T) -> T where T: Numeric
Restricts a numeric value to an inclusive range.
The receiver and bounds have one inferred numeric type and are evaluated once.
Parameters
minimum: The inclusive lower bound.maximum: The inclusive upper bound.
Effects: pure
Runtime behavior: available everywhere; synchronous
Examples
Restrict a value to a range
let visibleStage = 9u32.clamp(1, 7)