Difference between revisions of "Template:Switch"
Jump to navigation
Jump to search
(Document the usage) |
(Add default functionality) |
||
Line 1: | Line 1: | ||
<includeonly>{{{ {{{switch}}} }}}</includeonly><noinclude> | <includeonly>{{{ {{{switch|{{{default}}}}}} }}}</includeonly><noinclude> | ||
=Usage= | =Usage= | ||
Use the "switch" argument to select which argument to show: | Use the "switch" argument to select which argument to show: | ||
Line 5: | Line 5: | ||
*<nowiki>{{{Switch|yes=yay|no=nay|switch=no}}}</nowiki> will show "nay" | *<nowiki>{{{Switch|yes=yay|no=nay|switch=no}}}</nowiki> will show "nay" | ||
</noinclude> | </noinclude> | ||
The "default" argument will be used when the "switch" value doesn't match any of the options or that's empty: | |||
*<nowiki>{{{Switch|yes=yay|no=nay|default=maybe|switch=err}}}</nowiki> will show "maybe" |
Revision as of 15:27, 5 March 2009
Usage
Use the "switch" argument to select which argument to show:
- {{{Switch|yes=yay|no=nay|switch=yes}}} will show "yay"
- {{{Switch|yes=yay|no=nay|switch=no}}} will show "nay"
The "default" argument will be used when the "switch" value doesn't match any of the options or that's empty:
- {{{Switch|yes=yay|no=nay|default=maybe|switch=err}}} will show "maybe"