Template:Or/doc

From Moegirlpedia
< Template:Or
Revision as of 17:21, 11 April 2022 by LiaMinina (talk | contribs) (Created page with "== Introduction == This template is used to get the first non-null value of all parameters, avoiding writing something like blinding template code for <code><nowiki>{{{arg1|{{...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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|}}
}}