Template talk:Ifndef
From The Urban Dead Wiki
Jump to navigationJump to search
Usage
{{Ifndef|value|result}}
yields result if value is blank.
This simple template cannot be substituted, it's used to simplify the following equivalent but somewhat cryptic (names don't matter) code variants:
{{{2{{{1|}}}|}}}
{{{result{{{value|}}}|}}}
{{{then{{{test|}}}|}}}
Example
Code | Result |
1 {{Ifndef| |empty}}
|
1 empty |
2 {{Ifndef|x|gotcha}}
|
2 |
3 {{Ifndef| {{{1| }}} | {{{1| }}} undefined}}
|
3 undefined |
4 {{Ifndef| {{{1 }}} | {{{1 }}} bad idea}}
|
4 |
5 {{Ifndef| {{ns:0}} | main namespace}}
|
5 main namespace |
Unlike ifdef the minimalistic ifndef cannot reject a missing second parameter.
For more info see: meta.wikimedia.org Ifndef