<code>switch</code> compares a single value against multiple others, returning a string if a match is found. The syntax is basically:
<nowiki>{{</nowiki> #switch: ''<comparison value>>''|
| ''<value<supsub>1</sup>sub>>''=''<result<supsub>1</sup>sub>>''|
| ''<value<supsub>2</sup>sub>>''=''<result<supsub>2</sup>sub>>''|
| ''...''|
| ''<value<supsub>n</sup>sub>>''=''<result<supsub>n</sup>sub>>'' |
| ''<default result>>''
}}
Note that it's also possible to have "fall through" for values (reducing the need to duplicate results). For example:
<nowiki>{{</nowiki> #switch: ''<comparison value>>''|
| ''<value<supsub>1</sup>sub>>''|
| ''<value<supsub>2</sup>sub>>''|
| ''<value<supsub>3</sup>sub>>''=''<result<supsub>3</sup>sub>>''|
| ''...''|
| ''<value<supsub>n</sup>sub>>''=''<result<supsub>n</sup>sub>>'' |
| ''<default result>>''
}}
Note how value<supsub>1</supsub> and value<supsub>2</supsub> contain no equal sign. If they're matched, they are given the result for value<supsub>3</supsub> (that is, whatever is in result<supsub>3</supsub>).
Note that this special function can also be supported by an equivalent template, with a different but similar syntax.
See [[Template:switch]].
== expr ==
|