def

func:clamp

clamp(val, min, max)

Clamp the number val between the min and max. If its less than min then return min, if its greater than max return max, otherwise return val itself. The min and max must have matching units or be unitless. The result is always in the same unit as val.

Examples:

14.clamp(10, 20)     >>   14    // is between 10 and 20
3.clamp(10, 20)      >>   10    // clamps to min 10
73.clamp(10, 20)     >>   20    // clamps to max 20
45°F.clamp(60, 80)   >>   60°F  // min/max can be unitless

meta

supertypes

feature

Feature namespace of definitions formatted as feature:name

    func

Axon function