Open main menu

Template:Switch

Revision as of 17:20, 5 March 2009 by Jvprat (talk | contribs) (Another round trying to fix the default value)

This template allows you to conditionally show one of a predefined set of arguments, depending on another named argument.

Usage

Use the "switch" argument to select which argument to show:

  • {{Switch|yes=yay|no=nay|switch=yes}} shows "yay yay"
  • {{Switch|yes=yay|no=nay|switch=no}} shows "nay nay"

If the specified option is unknown, the "switch" value will be shown:

  • {{Switch|yes=yay|no=nay|switch=err}} shows "err err"

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}} shows "maybe maybe"