Difference between revisions of "Template:First-of/doc"

From Biowikifarm Metawiki
Jump to: navigation, search
(Created page with '{{Documentation/subpage}} This template takes up to four parameters, returning the first one that has any content. In contrast to default values of template parameters, this meth...')
 
m (1 revision)
Line 12: Line 12:
 
=== Usage ===
 
=== Usage ===
  
  <nowiki>{{First-of| {{{primary|}}} | {{{alternative|}}} | DefaultValue }}</nowiki>  
+
  <nowiki>{{First-of| {{{primary|}}} | {{{alternative|}}} | DefaultValue }}</nowiki>
 +
<nowiki>{{First-of| A | B | C }}</nowiki>
 +
 
 +
Result in:
 +
 
 +
{{First-of| {{{primary|}}} | {{{alternative|}}} | DefaultValue }}
 +
{{First-of| A | B | C }}
  
 
=== See also ===
 
=== See also ===

Revision as of 12:11, 16 October 2009

This is a documentation subpage for Template:First-of (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.

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| A | B | C }}

Result in:

DefaultValue
A

See also

Related documentation on Wikipedia