And: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
''result'' = ''x'' | ''result'' = ''x'' And ''y'' | ||
''result'' = ''x'' | ''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 == | |||
<pre> | <pre> | ||
REM | REM And Example | ||
' | 'And performs logical and bitwise conjunction | ||
DIM Test1, Test2, x, y | DIM Test1, Test2, x, y | ||
x = 2 | x = 2 | ||
y = 7 | y = 7 | ||
Test1 = x > 0 | Test1 = x > 0 And y < 10 | ||
Test2 = x > 0 | Test2 = x > 0 And y > 10 | ||
PRINT "Logical:" | PRINT "Logical:" | ||
PRINT " x > 0 | PRINT " x > 0 And y < 10 = " & Test1 | ||
PRINT " x > 0 | PRINT " x > 0 And y > 10 = " & Test2 | ||
PRINT "Bitwise" | PRINT "Bitwise" | ||
PRINT X | PRINT X Andb Y | ||
</pre> | </pre> | ||
== Output == | |||
<pre> | <pre> | ||
Logical: | Logical: | ||
x > 0 | x > 0 And y < 10 = True | ||
x > 0 | x > 0 And y > 10 = False | ||
Bitwise: | Bitwise: | ||
2 | 2 | ||
</pre> | </pre> | ||
== Related Items == | |||
[[eqv|EQV]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] | [[eqv|EQV]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] |
Revision as of 20:12, 8 August 2012
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