clamp


Description

With this function you can maintain an input value between a specified range.


Syntax:

clamp(val, min, max)


Argument Description
val The value to clamp.
min The minimum value to clamp between.
max The maximum value to clamp between.


Returns:

Real


Example:

speed = clamp(speed, 1, 10);

The above code will clamp the speed so that it never falls below 1 or goes over 10.