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

From blackwiki
Jump to navigation Jump to search
imported>Droll
(added category)
imported>Droll
(tweak)
Line 7: Line 7:
 
== Usage ==
 
== Usage ==
  
If '''a''' and '''b''' then '''x'''.
+
If '''a''' and '''b''' then true.
  
If '''a''' nor '''b''' then '''y'''.
+
If '''a''' nor '''b''' then false.
  
If '''a''' or '''b''' then '''y'''.
+
If '''a''' or '''b''' then false.
  
It can be used to replace the construct: <tt><nowiki>{{#if: a | {{#if: b | x | y }}</nowiki></tt>
+
It can be used to replace the construct: <tt><nowiki>{{#if:a|{{#if:b|true|false}}</nowiki></tt>
  
 
== Examples ==
 
== Examples ==
 +
<tt>
 +
<nowiki>{{if both| a | b |true|false}}</nowiki> → {{if both| a | b |true|false}}
  
<tt><nowiki>{{if both | a | b | x }}</nowiki></tt> → {{if both | a | b | x }}
+
<nowiki>{{if both| a | |true|false}}</nowiki> → {{if both| | b |true|false}}
  
<tt><nowiki>{{if both | a | | x | y }}</nowiki></tt> → {{if both | | b | x | y }}
+
<nowiki>{{if both| | b |true|false}}</nowiki> → {{if both| | b |true|false}}
 +
<tt>
  
<tt><nowiki>{{if both | | b | x | y }}</nowiki></tt> → {{if both | | b | x | y }}
+
Note that :
 +
<nowiki>{{if both| {{sp}} | b |true|false}}</nowiki> → {{if both| {{sp}} | b |true|false}}
  
 
== See also ==
 
== See also ==
Line 30: Line 34:
 
<noinclude>
 
<noinclude>
 
<!-- CATEGORIES GO HERE -->
 
<!-- CATEGORIES GO HERE -->
Category:If-then-else templates
+
[[Category:If-then-else templates]]
  
 
<!-- INTERWIKIS GO HERE -->
 
<!-- INTERWIKIS GO HERE -->
  
 
</noinclude>
 
</noinclude>

Revision as of 18:33, 12 October 2010


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

Usage

If a and b then true.

If a nor b then false.

If a or b then false.

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

Examples

{{if both| a | b |true|false}} → true

{{if both| a | |true|false}} → false

{{if both| | b |true|false}} → false

Note that : {{if both| {{sp}} | b |true|false}} → true

See also