Template:If empty/doc

This is the ifempty template.

This template is used inside other templates. It takes up to nine parameters and returns the first one that has any content. That is, the first one that is defined (not null) and not empty. Typical usage is like this:



Background
The MediaWiki parameter default function doesn't return the default value for empty parameters. That is,  does not return "default.svg" if the template was called like this:.

The usual workaround is to do like this:

But this becomes complex when you want to check several parameters:



Then it is easier to use this template instead:



Note! The parameters to must use the pipe "|", like this:. Or else will be fed and return the string " " if logo was not defined.

Examples
Fails. Note the lack of "|" in the first two parameters.

Fails. Note the lack of "|" in the first parameter.