Template:Qif/doc

From English Wikipedia @ Freddythechick

__EXPECTUNUSEDTEMPLATE__

Template:Qif formerly implemented an "if" function, which is now implemented by the parser function {{#if}}.

Purpose and function

Provides if then else functionality.

  • Parameter else is optional.
  • This template has undefined behaviour, if parameter test or then (or both) are missing.
  • This template also has undefined behaviour, if any parameter (be it named or unnamed) that is different from test, then or else is defined when calling the template.

Note that {{qif}} does not work when subst'ed (like {{ifndef}}, the then part alone as in {{ifdef}} can be substituted).

Of course it's impossible to use vertical bars in parameter values directly, use either | or Template:! – the latter is only relevant for wiki table delimiters.

Wikipedia CTO Brooke Vibber expressed support to implement the functionality of qif into MediaWiki; this became {{#if}}.

Usage

<syntaxhighlight lang="wikitext">

</syntaxhighlight>

Parameter else is optional. So this was also possible:

<syntaxhighlight lang="wikitext">

</syntaxhighlight>

Examples

Code Result

<syntaxhighlight lang="wikitext"></syntaxhighlight>

true

<syntaxhighlight lang="wikitext"></syntaxhighlight>

false

<syntaxhighlight lang="wikitext"></syntaxhighlight>

<syntaxhighlight lang="wikitext"></syntaxhighlight>

bar

See also