Template:If

From QBWiki
Revision as of 11:26, 18 December 2020 by Kevin Wang (talk | contribs)
Jump to navigation Jump to search


Replacement for #if.

Usage:

{{if
  |test=VARIABLE_OR_PARAMETER_TO_TEST
  |then=code if 'test' is not empty
  |else=code if 'test' is empty
}}

Parameter else is optional.

Examples:

{{if|test=x|then=y|else=z}} - x is not null, so return y
{{if|test= |then=y|else=z}} - x is null, so return z
{{if|test= |then=y}} - x is null and no else is defined, so don't return anything

y


z