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

From blackwiki
Jump to navigation Jump to search
imported>Droll
imported>Droll
(update)
Line 2: Line 2:
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
__NOTOC__
 
__NOTOC__
===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'''.
+
This [[Help:Templates/Helper templates|helper template]] is designed to be used in other templates. It can help editors create templates that or self documenting templates.
  
If either ''a'' or ''b'' are undefined then the template resolves to '''y'''.
+
== Usage ==
  
:<nowiki>{{if2 | a | b | x | y}}</nowiki>  --> {{if2|a|b|x|y}}
+
If '''a''' and '''b''' then '''x'''.
  
:<nowiki>{{if2 | a | &ensp; | x | y}}</nowiki> --> {{if2|a||x|y}}
+
If '''a''' nor '''b''' then '''y'''.
It can be used to replace the construct:
 
:<nowiki>{{#if: a | {{#if: b | x | y }}}}</nowiki>
 
  
 +
If '''a''' or '''b''' then '''y'''.
 +
 +
It can be used to replace the construct: <tt><nowiki>{{#if: a | {{#if: b | x | y }}</nowiki></tt>
 +
 +
== Examples ==
 +
 +
<tt><nowiki>{{if both | a | b | x }}</nowiki></tt> → {{if both | a | b | x }}
 +
 +
<tt><nowiki>{{if both | a | | x | y }}</nowiki></tt> → {{if both | | b | x | y }}
 +
 +
<tt><nowiki>{{if both | | b | x | y }}</nowiki></tt> → {{if both | | b | x | y }}
 +
 +
==See also===
 +
 +
* {{tl|ifempty}}
 +
* {{tl|if all}}
  
===See also===
 
*{{tl|ifempty}}
 
 
<noinclude>
 
<noinclude>
 
<!-- PLEASE ADD CATEGORIES AND  
 
<!-- PLEASE ADD CATEGORIES AND  

Revision as of 21:17, 31 July 2010


This helper template is designed to be used in other templates. It can help editors create templates that or self documenting templates.

Usage

If a and b then x.

If a nor b then y.

If a or b then y.

It can be used to replace the construct: {{#if: a | {{#if: b | x | y }}

Examples

{{if both | a | b | x }} → x

{{if both | a | | x | y }} → y

{{if both | | b | x | y }} → y

See also=