Template:If empty: Difference between revisions

Template page
No edit summary
m (Added description of the template in case I forget again)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#if: {{{1|}}} | {{{1}}} | {{#if: {{{2|}}} | {{{2}}} | {{#if: {{{3|}}} | {{{3}}} | {{#if: {{{4|}}} | {{{4}}} | {{#if: {{{5|}}} | {{{5}}} | {{#if: {{{6|}}} | {{{6}}} | {{#if: {{{7|}}} | {{{7}}} | {{#if: {{{8|}}} | {{{8}}} | {{#if: {{{9|}}} | {{{9}}} |  }} }} }} }} }} }} }} }} }}<noinclude>Returns the first non-empty parameter. Works up to 9 parameters but no further.</noinclude>
<noinclude>This template takes a series of arguments and returns the first non-empty argument.
 
Example:
 
<nowiki>{{If empty|a|b|c|d}}</nowiki>
 
In this situation, if a is not empty, it would return a, if it is empty, it would return b, unless it was also empty, then it would return c, and so on.</noinclude>{{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}

Latest revision as of 16:18, 13 April 2024

This template takes a series of arguments and returns the first non-empty argument.

Example:

{{If empty|a|b|c|d}}

In this situation, if a is not empty, it would return a, if it is empty, it would return b, unless it was also empty, then it would return c, and so on.