This template compares branching methods with and without Extension:ParserFunctions.

It shows, for all 27 possibilities of three parameters being non-empty, empty or undefined, the result of Template:Ifwp, #if with empty strings as default, and the concatenation of Template:Ifdef and Template:Ifndef.

Code:

{{{3{{{1|}}}|{{{1{{{1|}}}|{{{2|}}}}}}}}},{{#if:{{{1|}}}|{{{2|}}}|{{{3|}}}}},{{{1{{{1|}}}|{{{2|}}}}}}{{{3{{{1|}}}|}}}

Code Result
{{ifwpc|x|y|z}} y,y,y
{{ifwpc||y|z}} z,z,z
{{ifwpc|x||z}} ,,
{{ifwpc|x|y|}} y,y,y
{{ifwpc|x||}} ,,
{{ifwpc||y|}} ,,
{{ifwpc|||z}} z,z,z
{{ifwpc|||}} ,,
{{ifwpc|2=y|3=z}} z,z,yz
{{ifwpc|1=x|3=z}} ,,
{{ifwpc|x|y}} y,y,y
{{ifwpc|2=|3=z}} z,z,z
{{ifwpc|1=|3=z}} z,z,z
{{ifwpc||y}} ,,
{{ifwpc|2=y|3=}} ,,y
{{ifwpc|1=x|3=}} ,,
{{ifwpc|x|}} ,,
{{ifwpc|2=|3=}} ,,
{{ifwpc|1=|3=}} ,,
{{ifwpc||}} ,,
{{ifwpc|x}} ,,
{{ifwpc|2=y}} y,,y
{{ifwpc|3=z}} z,z,z
{{ifwpc|}} ,,
{{ifwpc|2=}} ,,
{{ifwpc|3=}} ,,
{{ifwpc}} ,,

All differences between the three methods occur with {{{1}}} undefined and {{{2}}} non-empty, in which case the codes reduce to:

{{{3|{{{2}}}}}},{{{3|}}},{{{2}}}{{{3|}}}

Code Result
{{ifwpc|2=y|3=z}} z,z,yz
{{ifwpc|2=y|3=}} ,,y
{{ifwpc|2=y}} y,,y

Differences between undefined and empty (which may or may not be desirable) occur in two methods with {{{2}}} non-empty, and {{{1}}} and {{{3}}} each empty or undefined, in which case the codes reduce to:

{{{3|{{{1|{{{2}}}}}}}}},,{{{1|{{{2}}}}}}

Code Result
{{ifwpc||y|}} ,,
{{ifwpc||y}} ,,
{{ifwpc|2=y|3=}} ,,y
{{ifwpc|2=y}} y,,y

Substitution

edit

Substitution works for all three methods.

See also

edit