Logical operations: Difference between revisions

Content deleted Content added
imported>Tromp
logical operations in BLC
Langurmonkey (talk | contribs)
Line 2,244: Line 2,244:


=={{header|langur}}==
=={{header|langur}}==
The logical operators in langur compare the "truthiness" of the left and right operands and do not require Booleans. A null is a non-truthy result.
The logical operators in langur compare the "truthiness" of the left and right operands and do not require Booleans.


The operators and, or, nand, nor, and?, or?, nand?, nor?, xor?, and nxor? are short-circuiting.
The operators and, or, nand, nor, and?, or?, nand?, nor?, xor?, and nxor? are short-circuiting.
Line 2,250: Line 2,250:
Operators that end with ? are null propagating or "database" operators, and will return null if either operand is null. They short-circuit differently than normal operators (only if the left operand is null).
Operators that end with ? are null propagating or "database" operators, and will return null if either operand is null. They short-circuit differently than normal operators (only if the left operand is null).


<syntaxhighlight lang="langur">val .test = f(.a, .b) join("\n", [
<syntaxhighlight lang="langur">val .test = fn(.a, .b) join("\n", [
$"not \.a;: \{not .a}",
$"not \.a;: \{not .a}",
$"\.a; and \.b;: \.a and .b;",
$"\.a; and \.b;: \.a and .b;",