Template:Or/doc

From Moegirlpedia
Jump to: navigation, search

Introduction

This template is used to get the first non-null value of all parameters, avoiding writing something like blinding template code for {{{arg1|{{{parameter1|{{#var:num1|{{#var:value|}}}}}}}}}}.

Parameters

  • (anonymous parameters): All incoming anonymous parameters will be checked from left to right, and if a non-null value is encountered, it will be returned.
  • default: If all (anonymous parameters) are empty, return the value specified by this parameter.

Examples

Example 1

{{or|<!-- (empty) -->|second|third}}

Result: second

Example 2

{{or|<!-- (empty) -->|<!-- (empty) -->|<!-- (empty) -->
|default=default
}}

Result: default

Example 3

For the code mentioned in #Introduction, you can write:

{{or
|{{{args1|}}}
|{{{parameter1|}}}
|{{#var:num1|}}
|{{#var:value|}}
}}