Template:Booland: Difference between revisions
Jump to navigation
Jump to search
imported>Rockdtben (Created page with "<includeonly>{{#if: {{{1|}}} | {{#if: {{{2|}}} | {{{3|1}}} | {{{4|}}} }} | {{{4|}}} }}</includeonly><noinclude>Logical and: <pre>if {{{1|}}} and {{{2|}}} then {{{3|1}}} el...") |
No edit summary |
||
Line 1: | Line 1: | ||
<includeonly>{{#if: {{{1|}}} | {{#if: {{{2|}}} | {{{3|1}}} | {{{4|}}} }} | {{{4|}}} }}</includeonly><noinclude>Logical and: <pre>if {{{1|}}} and {{{2|}}} then | <includeonly>{{#if: {{{1|}}} | {{#if: {{{2|}}} | {{{3|1}}} | {{{4|}}} }} | {{{4|}}} }}</includeonly><noinclude>Logical and: | ||
== About == | |||
Compact version of a boolean '''AND'''-operator: | |||
<pre>if {{{1|}}} and {{{2|}}} then | |||
{{{3|1}}} | {{{3|1}}} | ||
else | else | ||
{{{4|}}}</pre> | {{{4|}}}</pre> | ||
[[Category:Templates]]</noinclude> | == Parameter-Usage == | ||
{| class="wikitable" | |||
!Parameter | |||
!Description | |||
|- | |||
!1, 2 | |||
|Conditions, evaluate true if neither missing and empty. A condition evaluates true for any non-empty text. | |||
|- | |||
!3 | |||
|Result if both conditions are true | |||
|- | |||
!4 | |||
|Result if at least one of the conditions is false | |||
|} | |||
== Examples == | |||
{| class="wikitable" | |||
!Code | |||
!Result | |||
!Comment | |||
|- | |||
|<code><nowiki>{{Booland|A||Yup|Nope}}</nowiki></code> | |||
|{{Booland|A|B|Yup|Nope}} | |||
| | |||
|- | |||
|<code><nowiki>{{Booland|A||Yup|Nope}}</nowiki></code> | |||
|{{Booland|A||Yup|Nope}} | |||
| | |||
|- | |||
|<code><nowiki>{{Booland||B|Yup|Nope}}</nowiki></code> | |||
|{{Booland||B|Yup|Nope}} | |||
| | |||
|- | |||
|<code><nowiki>{{Booland|||Yup|Nope}}</nowiki></code> | |||
|{{Booland|||Yup|Nope}} | |||
| | |||
|- | |||
|<code><nowiki>{{Booland|true|false|Yup|Nope}}</nowiki></code> | |||
|{{Booland|true|false|Yup|Nope}} | |||
|Conditions are checked as texts not as boolean values | |||
|- | |||
|<code><nowiki>{{Booland|1|0|Yup|Nope}}</nowiki></code> | |||
|{{Booland|1|0|Yup|Nope}} | |||
|Conditions are checked as texts not as (boolean) numbers | |||
|- | |||
|<code><nowiki>{{Booland| | |Yup|Nope}}</nowiki></code> | |||
|{{Booland| | |Yup|Nope}} | |||
|Spaces alone don't count as values | |||
|} | |||
[[Category:Templates]] | |||
</noinclude> |
Revision as of 09:29, 24 April 2020
Logical and:
About
Compact version of a boolean AND-operator:
if {{{1|}}} and {{{2|}}} then {{{3|1}}} else {{{4|}}}
Parameter-Usage
Parameter | Description |
---|---|
1, 2 | Conditions, evaluate true if neither missing and empty. A condition evaluates true for any non-empty text. |
3 | Result if both conditions are true |
4 | Result if at least one of the conditions is false |
Examples
Code | Result | Comment |
---|---|---|
{{Booland|A||Yup|Nope}}
|
Yup | |
{{Booland|A||Yup|Nope}}
|
Nope | |
{{Booland||B|Yup|Nope}}
|
Nope | |
{{Booland|||Yup|Nope}}
|
Nope | |
{{Booland|true|false|Yup|Nope}}
|
Yup | Conditions are checked as texts not as boolean values |
{{Booland|1|0|Yup|Nope}}
|
Yup | Conditions are checked as texts not as (boolean) numbers |
{{Booland| | |Yup|Nope}}
|
Nope | Spaces alone don't count as values |