Constricts a number between the Low and High values provided. If the number is between those values, it is unchanged. If it exceeds the Low or High values, those will be returned.
world.log << clamp(5, 1, 10) // 5
world.log << clamp(1, 5, 10) // 5
world.log << clamp(15, 1, 10) // 10
When operating on a list, this functions as if clamp()
has been run on each entry in the list.
= list(1, 2, 3, 4, 5, 6, 7, 8, 9)
for( in (my_list, 1, 5))
world.log << num // 1, 2, 3, 4, 5, 5, 5, 5, 5
Parity Issue ⚠️
A new list will always be returned from the
clamp()
proc, it does not operate in place