From PCSAR
			
												
			This is the documentation for the template Template:If
 Template:If/Doc:
| 
 The template {{If|subst=subst:}}
 Based on
http://meta.wikimedia.org/wiki/Template:If
 
-  4 parameters:
{{if||x| p | q }} gives " p "
{{if||| p | q }} gives " q "
{{if|expr|2<3| p | q }} gives " p "
{{if|expr|2>3| p | q }} gives " q "
{{if|expr|2{{=}}3| p | q }} gives " q "
{{if|expr||2=2=3| p | q }} gives " q "
{{if|exist| Template:If | p | q }} gives " p "
{{if|exist| No Such:If | p | q }} gives " q "
{{if|error|<span class{{=}}"error">x</span>| p | q }} gives " p "
{{if|error| 7 | p | q }} gives " q "
{{if|error| 7 | p | }} gives " "
{{if|error| 7 | p |}} gives ""
{{if|error| 7 | p }} gives " 7 "
 
 -  5 parameters:
{{if|eq| u |u| p | q }} gives " p "
{{if|eq| u |v| p | q }} gives " q "
 
  
Compare:
 
-  3 parameters:
{{#if:x| p | q }} gives "p"
{{#ifexpr:2<3| p | q }} gives "p"
{{#ifexist: Help:Link | p | q }} gives "q"
{{#iferror:<span class="error">x</span>| p | q }} gives "p"
{{#iferror: 7 | p | q }} gives "q"
{{#iferror: 7 | p | }} gives ""
{{#iferror: 7 | p |}} gives ""
{{#iferror: 7 | p }} gives "7"
 
 -  4 parameters:
{{#ifeq: u |u| p | q }} gives "p"
 
  
Note that, unlike parser functions, templates require writing equals signs in values of unnamed parameters as {{=}}
 For full substitution, simply use Template:Cnw or Template:Cnw. If the condition contains a parser function, template, or variable, that should be substituted too. Optionally the "then" or "else" part can also be substituted.
 Error messages (examples):
 
{{if|expr|1234>e3|1|0}} gives Template:If: "#ifexpr:1234>e3" should give Expression error: Unexpected number but may not be evaluated due to the expansion depth limit.
{{#ifexpr:1234>e3|1|0}} gives Expression error: Unexpected number
 
 | 
To see how this template is implemented,
edit this page and examine the portion 
between <includeonly> and </includeonly>.