Jump to content

Template:or else/documentation

From Wiktionary, the free dictionary
Documentation for Template:or else. [edit]
This page contains usage information, categories, interwiki links and other content describing the template.

Usage

[edit]

{{or else|VAL1|VAL2}} is equivalent to {{#if:VAL1|VAL1|VAL2}}.

You should generally use a construct like {{or else|{{{param|}}}|default value}} in preference to {{{param|default value}}}. The former will substitute the default value when the parameter is either empty or undefined, while the latter will only substitute the default value when the parameter is undefined. Attempting to pass an undefined parameter to a subtemplate will convert it to an empty parameter, and code that distinguishes between undefined and empty parameters will then fail.