Template:Map/Clip

Clips a value to a range. If out of range will be restrained to maximum nearest value, or a default value. This template is used by Map templates, and not normally used directly, though it can be. See Template:.


 * Usage
 * 1 - number to test
 * 2 - minimum value. Default is 0
 * 3 - maximum value. Default is 100
 * 4 - default value to use if test fails or value is outside range. Optional
 * Returns - arg1 clipped to the range of min to max. Returns 'min' if arg1 is less than 'min' or not a number, or 'max' if arg1 is more than 'max'. If arg2 is set then returns arg2 if arg1 is not a number or outside 'min' and 'max'. If not a number and no default is supplied then returns 'min'.

Bad or empty values &rarr; &rarr; Values in and out of range &rarr; &rarr; &rarr; &rarr; &rarr; Values clipped to other extents &rarr; &rarr; Values out of range using default values rather than clipping &rarr; &rarr;
 * Examples