Template:If

From Userful Support
Jump to: navigation, search


Template: if -- performs if-then-else

Parameters:

  • 1 -- the condition to test (defined or undefined parameter, etc.)
  • then -- what to do if condition is true
  • else -- what to do if condition is false

Usage:

{{if|somecondition|then=dosomething|else=dosomethingelse}}
Note that you can skip then or else if you do not want to include it. Examples:
{{if|{{{username|}}}|then=Name is {{{username}}}|else=Who is this?}}
{{if|{{{username|}}}|else=Who is this?}}