Logical operations: Difference between revisions

Content added Content deleted
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 = fn(.a, .b) join("\n", [
<syntaxhighlight lang="langur">val .test = fn(.a, .b) {
join("\n", [
$"not \.a;: \{not .a}",
$"\.a; and \.b;: \.a and .b;",
$"not \.a;: \{not .a}",
$"\.a; or \.b;: \.a or .b;",
$"\.a; and \.b;: \.a and .b;",
$"\.a; nand \.b;: \.a nand .b;",
$"\.a; nand \.b;: \.a nand .b;",
$"\.a; nor \.b;: \.a nor .b;",
$"\.a; or \.b;: \.a or .b;",
$"\.a; xor \.b;: \.a xor .b;",
$"\.a; nor \.b;: \.a nor .b;",
$"\.a; nxor \.b;: \.a nxor .b;",
$"\.a; xor \.b;: \.a xor .b;",
$"\.a; nxor \.b;: \.a nxor .b;",
"",
"",

$"not? \.a;: \{not? .a}",
$"\.a; and? \.b;: \.a and? .b;",
$"not? \.a;: \{not? .a}",
$"\.a; or? \.b;: \.a or? .b;",
$"\.a; and? \.b;: \.a and? .b;",
$"\.a; nand? \.b;: \.a nand? .b;",
$"\.a; nand? \.b;: \.a nand? .b;",
$"\.a; nor? \.b;: \.a nor? .b;",
$"\.a; or? \.b;: \.a or? .b;",
$"\.a; xor? \.b;: \.a xor? .b;",
$"\.a; nor? \.b;: \.a nor? .b;",
$"\.a; nxor? \.b;: \.a nxor? .b;",
$"\.a; xor? \.b;: \.a xor? .b;",
"\n",
$"\.a; nxor? \.b;: \.a nxor? .b;",
"\n",
])
])
}


val .tests = [
val .tests = [