This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ==== CLAMP ==== Macro that will return a value limited to a given range === Description === <code>CLAMP( value, minimum, maximum )</code> Returns the ''value'' if it is within the range ''minimum'' to ''maximum''. If the ''value'' is smaller than ''minimum'', returns ''minimum''. If the ''value'' is larger than ''maximum'', returns ''maximum''. Works with both float and integer parameters. === Parameters === | ''value'' | input value | | ''minimum'' | smallest allowed value | | ''maximum'' | largest allowed value | === Return value === Returns the ''value'' limited to within the given range. === Example usage === <code javascript> new n, x; n = 60; x = CLAMP(n, 30, 90); // 60 x = CLAMP(n, 10, 20); // 20 </code> ezeio2/scriptref/clamp.txt Last modified: 2019-11-19 00:19by andreh Log In