Template:Qif/doc

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 &amp;#124; or Template:! - the latter is only relevant for Wiki table delimiters.

Usage
Parameter else is optional. So you may also do:

Note that if you are using Qif inside a template to determine if a template parameter has been defined with a non-empty value, you should test the parameter with an emnpty default.

Example:

Inside a template defination, this will return "Present" if the enclosing template has a parameter "Check" with a non-empty value, and "Absent" otherwise.

Caveats
In templates the characters "=" (&amp;#61;) and "|" (&amp;#124;) cannot be used as is in parameters. The numeric character references &amp;#61; and &amp;#124; are often good enough, but for Wiki and XHTML markup the literal characters are required: Substitution works only for, but not for or.
 * 1) For | template:! ( edit•talk•links•history ) offers a workaround.
 * 2) For = the template parameter mechanism allows  resulting in "ok=yes" instead of  resulting in " "

Source
This documentation (or its inital version, it may have been edited here since) is copied from Wikipedia:Template talk:Qif, under the GNU Free Documentation License (GFDL) (under which all wikipedia text is released). See that page and its archives for related information and caveats.

The template itself was copied from Wikipedia:Template:Qif, and then modified. The template was also released under the GFDL.

See also: Wikipedia:Wikipedia:ParserFunction precursors

Applies to
This is the documentation page for Template:Qif, transcluded from Template:Qif/doc.

Note that Qif is protected, as a high risk template.