Logical operations: Difference between revisions
→{{header|Commodore BASIC}}: Add XOR from BASIC 7.
(Added credits) |
(→{{header|Commodore BASIC}}: Add XOR from BASIC 7.) |
||
Line 602:
==={{header|Commodore BASIC}}===
In Commodore BASIC the "logical" operators are actually bitwise operators; to enable the proper semantics when they're used for logic, true expressions return -1 (all bits set) and false expressions return 0 (all bits clear).
<lang qbasic>10 A = -1
20 B = 0
Line 615:
-1
0</pre>
{{works with|Commodore BASIC 7.0}}
Commodore BASIC version 7 for the C-128 added XOR, but it's a function, and for some reason was written to accept only unsigned (16-bit) numbers.
<lang basic>70 PRINT XOR(1, 0)</lang>
{{out}}
<pre>1</pre>
==={{header|BASIC256}}===
|