Module:Range/doc

From blackwiki
< Module:Range
Revision as of 05:08, 14 March 2013 by blackwiki>קיפודנחש (negative and e-notation.)
Jump to navigation Jump to search

This is the documentation page for Module:Range

returns one function called "iswitch", which takes its inspiration from {{#switch, but is limited to numeric values, and allows for ranges.

usage:

{{#invoke|Range|inrange
| 12
| 1 2 3..7 50..70 = one, two, three to seven, or fifty to seventy
| 9..40 = between nine and fourty 
| -2e9..0.75 = between minus two billion and three quuarters
| default = None of the ranges matches 12
}}

syntax: {{#invoke:Range | iswitch | <Number> | (<Range> = Value | )... [default=Value] }}

<Number> ::= [-][digits][.][digits][e digits]
<Range> ::= [<Number> | <Number>..<Number>]...
Value ::= any string that does not contain | or }}

if the first parameter matches a ranges, function will return the values of one of the matching ranges. If more than one range matches, it is unpredictable which of the values will be returned.

if none of the ranges match, and there is a "default", this value will return. otherwise, the function will return an empty string.