Difference between revisions of "Template:If both/doc"

From blackwiki
Jump to navigation Jump to search
imported>Droll
(tidied up)
imported>Droll
(added an example)
Line 11: Line 11:
 
If either ''a'' or ''b'' are undefined then the template resolves to ''y'.
 
If either ''a'' or ''b'' are undefined then the template resolves to ''y'.
  
<nowiki>{{if a | b | x | y}} --> x</nowiki>
+
:<nowiki>{{if2 a | b | x | y}} --> x</nowiki>
  
<nowiki>{{if a | &ensp;  | x | y}} --> y</nowiki>
+
:<nowiki>{{if2 a | &ensp;  | x | y}} --> y</nowiki>
 +
It can be used to replace the construct:
 +
:<nowiki>{{#if: a |{{#if: b | x | y }}}</nowiki>
  
  

Revision as of 18:35, 9 February 2010

Purpose

This simple template is designed to facilitate template coding and should only be used in templates.

Function

The functionality is simple. If a and b then x else y.

I both a and b are defined then the template resolves to x.

If either a or b are undefined then the template resolves to y'.

{{if2 a | b | x | y}} --> x
{{if2 a |   | x | y}} --> y

It can be used to replace the construct:

{{#if: a |{{#if: b | x | y }}}


See also