This helper template is designed to be used in other templates. It can help editors create template code that is more self documenting. A major advantage of usi…
{{if either (|a) (|b) (|first result) (|second result)}}This helper template is designed to be used in other templates. It can help editors create template code that is more self documenting. A 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").
| 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 |
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.