TeleFlow BasicScript AndOrXorNot
From TeleFlow
(New page: AND, OR, XOR and NOT are logical operators performing element-wise logic, returning true (nonzero) or false (zero) as follows:<br> <br> <b>AND:</b> if both values on the left and the right...) |
|||
Line 12: | Line 12: | ||
<br> | <br> | ||
BasicScript code<br> | BasicScript code<br> | ||
- | <br> | ||
- | Result<br> | ||
<br> | <br> | ||
print (3 AND 2)<br> | print (3 AND 2)<br> |
Revision as of 00:52, 17 May 2008
AND, OR, XOR and NOT are logical operators performing element-wise logic, returning true (nonzero) or false (zero) as follows:
AND: if both values on the left and the right side of the operator are different from zero, then AND returns one, otherwise it returns zero.
OR: if at least one value from the left or the right side of the operator is different from zero, then OR returns one, otherwise it returns zero.
XOR: if one and only one value from the left or the right side of the operator is different from zero, then OR returns one, otherwise it returns zero.
NOT: if the value on the right side of this operator is zero, NOT returns one, otherwise it returns zero.
Examples:
BasicScript code
print (3 AND 2)
- 1
print (3 OR 2)
- 1
print (3 XOR 2)
- 0
print (3 NOT 2)
- 0
