Template:Ifdef/doc
This is a documentation subpage for Template:Ifdef. It contains usage information, categories, and other content that is not part of the original template page. |
This template provides branching without Extension:ParserFunctions for simple "if defined then do" statements without else part. It is the opposite of Template:Ifndef.
See Template:Ifwpc for an overview of results, and comparisons.
Usage
edit{{ifdef|value|result}}
yields result if value isn't blank.
It uses the code {{{1{{{1|}}}|{{{2|}}}}}}
.
Examples
editCode | Result |
---|---|
{{ifdef|x|y}}
|
y |
{{ifdef||y}}
|
|
{{ifdef|2=y}}
|
y |
{{ifdef|x}}
|
|
{{ifdef|}}
|
|
{{ifdef}}
|
Substitution
editConvenient of the parameter default mechanism is that substitution works also, without any extra code.