Template:Booland: Difference between revisions

1,180 bytes added ,  09:29, 24 April 2020
no edit summary
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>
1,133

edits