Module:Range/doc
< Module:Range
Jump to navigation
Jump to search
Revision as of 22:51, 15 March 2013 by blackwiki>WOSlinker ({{documentation subpage}})
This is the documentation page for Module:Range
| File:Edit-copy green.svg | This is a documentation subpage for Module:Range. It contains usage information, categories and other content that is not part of the original module page. |
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
| value = 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 | value = <Number> | ( <Range> = Result | )... [default=Result] }}
- <Number> ::= [-][digits][.][digits][e digits]
- <Range> ::= [<Number> | <Number>..<Number>]...
- Result ::= any string (can be multiline) that does not contain | or }} (if needed, use Template:T, and Template:T. )
if value matches a ranges, the function will return the "Result" of one of the matching ranges. If more than one range matches, it is unpredictable which of the results will be returned. The function does not test for overlap.
if none of the ranges match, and there is a "default", this value will return. otherwise, the function will return an empty string.