Template:All-of/doc

From Angelina Jordan Wiki
Revision as of 03:05, 11 September 2022 by Dcljr (talk | contribs) (use letters for values, other ce)
This is a subpage documenting Template:All-of. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template checks whether all of a set of parameters have defined, true values (values containing at least one non-whitespace character), in which case it returns the single character "1" (a true value); otherwise, it returns a null/empty value (false). Of course, this is really only useful inside of an {{#if:}} parser-function call (for help, see the previous link and Template:Test-if), and so should only be used inside of other templates, not directly in articles.

This template is necessary because it is much more difficult (i.e., requires more typing) to check for the truth of all of a set of parameters than to check for any of them (for which, just chain them together — if any are true, the final value will be true).

Currently, up to 5 positional parameters are supported, with no named parameters (although the positional parameters can be referred to by number, as seen in the third and fourth examples below).

Usage

  • {{all-of|param1|param2|}}

Examples

  • {{all-of}}
  • {{all-of|}}
  • {{all-of|1=}}
  • {{all-of|1=A|2=B|3=C}} ⇒ 1
  • {{all-of|A|B|C}} ⇒ 1
  • {{all-of|A|B|C|}}
  • {{all-of|A||C||E}}
  • {{all-of|A| |C| |E}}
  • {{all-of|A|B|C|D|E}} ⇒ 1
  • {{all-of|A|B|C|D|E|}} ⇒ 1

Note how in the last example, the empty sixth positional parameter is ignored. This template only checks for the first 5 positional parameters.