This wiki has been closed because there have been no edits or logs made within the last 60 days. This wiki is now eligible for being adopted. To adopt this wiki please go to Requests for adoption and make a request. If this wiki is not adopted within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki you can go to Special:ManageWiki and uncheck the "closed" box to reopen it.

Template:If either

From ModelUSGov Wiki
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]
{{if either (|a) (|b) (|first result) (|second result)}}
 "If either (a or) (b) is true, (return first result,) (else return second result)."

This helper template is designed to be used in other templates. It can help editors create template code that or self documenting. The major advantage of using this template over using the construct {{#if:{{{1|}}}{{{2|}}} |…}} is that if the first parameter is not empty then the second parameter is not evaluated.

The "or" in the "a or b" above is inclusive: if both a and b are true, the template will return the first result.

This template can also be used to replace the construct {{#if:a |true |{{#if:b |true |false}}}} (i.e. "if a, then true; else if b, then true; else false").

Examples

Code Result
{{if either |a |b |true |false}} true
{{if either |a | |true |false}} true
{{if either | |b |true |false}} true
{{if either | | |true |false}} false

See also