Logical operations: Difference between revisions
Content added Content deleted
(Added various BASIC dialects (Chipmunk Basic, GW-BASIC, MSX Basic and Quite BASIC)) |
imported>Brie (Add Nu) |
||
Line 2,990: | Line 2,990: | ||
echo "not a: ", not a |
echo "not a: ", not a |
||
echo "a xor b: ", a xor b</syntaxhighlight> |
echo "a xor b: ", a xor b</syntaxhighlight> |
||
=={{header|Nu}}== |
|||
<syntaxhighlight lang="nu"> |
|||
def ops [a b] {{A: $a, B: $b, "Not A": (not $a), OR: ($a or $b), AND: ($a and $b), XOR: ($a xor $b)}} |
|||
[true false] | each {[[true $in] [false $in]]} | flatten | each {ops $in.0 $in.1} |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
╭───┬───────┬───────┬───────┬───────┬───────┬───────╮ |
|||
│ # │ A │ B │ Not A │ OR │ AND │ XOR │ |
|||
├───┼───────┼───────┼───────┼───────┼───────┼───────┤ |
|||
│ 0 │ true │ true │ false │ true │ true │ false │ |
|||
│ 1 │ false │ true │ true │ true │ false │ true │ |
|||
│ 2 │ true │ false │ false │ true │ false │ true │ |
|||
│ 3 │ false │ false │ true │ false │ false │ false │ |
|||
╰───┴───────┴───────┴───────┴───────┴───────┴───────╯ |
|||
</pre> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |