Vorlage:First-of

Aus Bayernflora
Version vom 23. Oktober 2013, 13:24 Uhr von Iris Leininger (Diskussion | Beiträge) (1 Version)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche
[Bearbeiten] [Aktualisieren] Template-info.svg Dokumentation der Vorlage

This template takes up to four parameters, returning the first one that has any content. In contrast to default values of template parameters, this method is not sensitive to the difference between undefined (Null) and empty string.

Background

Normally, a template parameter evaluated with a default value, such as "{{{parameter1 | MISSING }}}" will return the default value ("Missing") if not appearing in the template call, but an empty string ("") if the template call contains:

| ...
| parameter1=
| ...

Usage

{{First-of| {{{primary|}}} | {{{alternative|}}} | DefaultValue }}
{{First-of|  | B | C }}
{{First-of|1=|2=B|3=C}}

Result in:

DefaultValue
B
B

See also

Related documentation on Wikipedia