Jump to content

User:Who R you?/sandbox21/doc

From Wikipedia, the free encyclopedia

Returns the test value prefixed and suffixed with appropriate values dependant upon whether test value matches.

Usage

{{ If is| Test| Value| Then prefix| Then suffix| Else prefix| Else suffix}}

where (unnamed parameters, in sequence) represent

Test something to be compared to Value (parameter # 2).
Value something to compare Test (parameter # 1) to.
Then prefix [optional], if Test = Value, returned added to the beginning of Test.
Then suffix [optional], if Test = Value, returned added to the end of Test.
Else prefix [optional] returned added to the beginning of Test if Test does not match Value.
Else suffix [optional] returned added to the end of Test if Test does not match Value.


Example

{{ If is| 1| 0| Then Prefix←| →Then Suffix| Else Prefix| Else Suffix}}

yields
  Else Prefix1Else Suffix

{{ If is| 1| 1| Then Prefix←| →Then Suffix| Else Prefix| Else Suffix}}

yields
  Then Prefix←1→Then Suffix

{{ If is| 1| 0| | | Else Prefix| Else Suffix}}

yields
  Else Prefix1Else Suffix

{{ If is| 1| 1| | | Else Prefix| Else Suffix}}

yields
  1

{{ If is| 1| 0| Then Prefix←| →Then Suffix| | }}

yields
  1

{{ If is| 1| 1| Then Prefix←| →Then Suffix| | }}

yields
  Then Prefix←1→Then Suffix

yields

  City, Prov

yields

  [[City, Prov]]

{{ If is| 1| 0| Then Prefix←| →Then Suffix}}

yields
  1

{{ If is| 1| 1| Then Prefix←| →Then Suffix}}

yields
  Then Prefix←1→Then Suffix


See also

  • {{If is}} returns prefixed/suffixed test value; prefix/suffix depend of whether test value matches.
  • {{If found}} returns prefixed/suffixed test value if test exists; alternately uses different prefixing/suffixing or returns a different value if test does not exist.

Category:If-then-else templates