Template:or else

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Usage

{{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.