Template talk:If equal

See also the generalized version Template:If equal g, with the three parameters of the final template independent of the two test parameters, and the simplified Template:Ine, where the criterion is being equal to the empty string, and the task for that case is producing nothing.

Description of what this template does:

If the 3rd and 4th parameter are equal then call the template specified by the 1st parameter, otherwise that by the 2nd. Each can have up to three unnamed parameters specified as the 4th, 5th and 6th parameter.

For each value of the 3rd parameter an auxiliary template callpar is needed, with the content {{{{{par }}}|{{{1}}}|{{{2}}}|{{{3}}}}} (currently available: list).

*{{if equal|t|t2||a|b|c}}
*{{if equal|t|t2|||b|c}}
*{{if equal|x0|death||[[November 2]], [[2004]]|[[Amsterdam]]|}}
*>{{if equal|x0|death||||}}<

give:

Some auxiliary templates that can be used:

Adaptation to more parameters edit

As mentioned, the two final templates can have up to three unnamed parameters. Adaptation to more involves adapting:

  • template "if equal"
  • template callpar

Typically, template:If equal is called from an infobox. Then, with regard to the number of these final parameters the following sequence should be non-increasing:

  • The number of parameters supplied by the page calling the infobox
  • The number of parameters supplied by the infobox calling "if equal"
  • The number of parameters supplied by "if equal" calling callpar (currently 3, and for "if equal 6", calling call6par, 6)
  • The number of parameters supplied by callpar (currently 3, and for call6, 6)
  • The number of parameters used by the two final templates (in the examples above: 0, 1, and 2)

An exception is that if the infobox calls "if equal" with one or more parameters which are a constant or depend on a variable, but do not depend on a parameter of the infobox; in that case the page that calls the infobox does not have to supply that value. Also several parameter values with which the infobox calls "if equal" may be (or depend on) the same parameter of the infobox. In these cases the number of parameters supplied by the page calling the infobox can be less than the number of parameters supplied by the infobox calling "if equal".

See also edit

Similar templates:

Usage of these templates:

Another special template:

Return to "If equal" page.