Template talk:Ifndef

From The Urban Dead Wiki
Revision as of 09:50, 19 January 2008 by Karek (talk | contribs) (Moving from main, If Templates are, when used, often called mutilple times in a template, having this on the main page reduces the possible number of calls.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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