clamp - clamp a value between two scalar limits
val.clamp(
lo,hi)
The clamp method compares the val to the scalars lo and hi and returns a value clamped between lo and hi, inclusive.
The clamped value
RangeCheck
if lo is not less than or
equal to hi
TypeCheck
if
val, lo, or hi are not numeric
TypeCheck
if lo or hi are not
scalar
a = 10->iterate() a.clamp(2,7) 2 2 2 3 4 5 6 7 7 7