Jump to content

Template:Pp/doc

From Meta, a Wikimedia project coordination wiki

This template contains {{{{{{1}}}}}}.

If the first parameter is an integer > 1 this template corresponds to:

{{p{{#expr:{{{1}}}-1}}|{{{2}}}|{{{3}}}|{{{4}}}|..}}

Apart from the fact that it does not trim the result it also corresponds to:

{{#switch:{{{1}}}|2={{{2}}}|3={{{3}}}|4={{{4}}}|..}}

or similar with other parameter names.

If lb is a lower bound on the values of {{{1}}} we can use {{pp|{{#expr:{{{1}}}+2-lb}}|fa|fb|..}}. This not only allows low values of {{{1}}} if the lower bound is less than 2, but it also reduces the parameter numbers if the lower bound is greater than 2. For example, if {{{1}}} is in the range 100-110 we can use unnamed parameters without specifying dummy values for the parameters 2-99: {{pp|{{#expr:{{{1}}}-98}}|f100|f101|..}}.

Usage

[edit]
  • "{{pp| 1 | 9 | 7 }}" gives "1" [1]
  • "{{pp| 2 | 9 | 7 }}" gives "9" [2]
  • "{{pp| 3 | 9 | 7 }}" gives "7" [3]
  • "{{pp| a | a = 9 | b = 7 }}" gives "9"
  • "{{pp| b | a = 9 | b = 7 }}" gives "7"

Compare:

  • "{{p1| 9 | 7 }}" gives " 9 " [4]
  • "{{p2| 9 | 7 }}" gives " 7 " [5]
  • {{sw|2||2| 9 |3| 7 }} gives "9"
  • {{sw|3||2| 9 |3| 7 }} gives "7"

Trimming:

  • {{#switch:2|2= 9 |3= 7 }} gives "9"
  • {{#switch:3|2= 9 |3= 7 }} gives "7"
  • {{switch|2|case: 2= 9 |case: 3= 7 }} gives "9"
  • {{switch|3|case: 2= 9 |case: 3= 7 }} gives "7"