
Commands - 3
AND
Numeric Fun ction
SYNTAX: n = a AND b
PURPOSE: Performs bitwise or logical operation on two numbers. AND'ing is usually performed during I/O
operations to set a line low.
REMARK S: Variables a and b are in the range of 0 to 65,535 (&FF FF). When printed, numbers greater than
32,768 are negative.
Logical A ND' ing is performed during IF -THEN operations to test if all conditions ar e met.
RELATED: OR, XOR
EXAMPLE: 10 A = INP(0) :'get current status of port
20 A = A AND &FE :'set bit number 1 low
30 OUT 0,A :'output new status
40 PRINT A
RUN
8
Use AND in an IF-THEN statement to make sure all conditions are true.
10 IF (TEMPERATURE > 100) AND (HUMIDITY < 5) THEN GOTO ..dry
When the variable TEM PERATURE is more than 3 and variable HUM IDITY < 25 then the
condition is true. In this case, AND returns a true (non-zero) condition.
ERROR: none
Komentarze do niniejszej Instrukcji