Difference between revisions of "Template:If both/doc"
Jump to navigation
Jump to search
imported>Droll (tweak) |
imported>Droll (tweak) |
||
| Line 7: | Line 7: | ||
The functionality is simple. If '''a''' and '''b''' then '''x''' else '''y'''. | 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''. | + | 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'. | + | If either ''a'' or ''b'' are undefined then the template resolves to '''y'''. |
:<nowiki>{{if2 | a | b | x | y}}</nowiki> --> {{if2|a|b|x|y}} | :<nowiki>{{if2 | a | b | x | y}}</nowiki> --> {{if2|a|b|x|y}} | ||
Revision as of 00:59, 11 February 2010
| This is a documentation subpage for Template:If both. It contains usage information, categories and other content that is not part of the original template page. |
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
- {{ifempty}}