And: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
result = x ANDb y | result = x ANDb y | ||
'''Description''' | '''Description''' | ||
Line 12: | Line 11: | ||
ANDb does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in x and y are 1, otherwise it is set to 0. | ANDb does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in x and y are 1, otherwise it is set to 0. | ||
'''Example''' | '''Example''' | ||
Line 42: | Line 39: | ||
2 | 2 | ||
</pre> | </pre> | ||
'''Related Items''' | '''Related Items''' | ||
[[readfile|READFILE]], [[evq|EQV]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] | [[readfile|READFILE]], [[evq|EQV]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] |
Revision as of 04:29, 29 June 2012
Operator
result = x AND y
result = x ANDb y
Description
AND returns the logical conjunction of two expressions. result is TRUE, if and only if both expressions x and y evaluate to TRUE, otherwise, result is FALSE.
ANDb does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in x and y are 1, otherwise it is set to 0.
Example
REM AND Example 'AND performs logical and bitwise conjunction DIM Test1, Test2, x, y x = 2 y = 7 Test1 = x > 0 AND y < 10 Test2 = x > 0 AND y > 10 PRINT "Logical:" PRINT " x > 0 AND y < 10 = " & Test1 PRINT " x > 0 AND y > 10 = " & Test2 PRINT "Bitwise" PRINT X ANDb Y
Output
Logical: x > 0 AND y < 10 = True x > 0 AND y > 10 = False Bitwise: 2
Related Items