HTBasic Help
×
Menu
Index

Logical and Binary

 
Logical operators can be used on integer or real numbers. The two values are first converted to logical (TRUE=1, FALSE=0) values, the operation is done, and the result is converted to an integer. When converting numbers to logical values, zero is converted to FALSE and non-zero is converted to TRUE. When converting the result to an integer, FALSE is converted to a zero, and TRUE is converted to a one.
 
Operator
Meaning
Example
Result
AND
Logical "and"
2 AND 3
1
EXOR
Logical "exclusive or"
2 EXOR 3
0
OR
Logical "or"
1 OR 0
1
NOT
Logical "not"
NOT 1
0
 
Binary functions perform bit-wise operations on integer numeric values. They may be used to manipulate bits or to perform conditional operations based on their logical result.                
 
Operator
Meaning
Example
Result
BINAND
Bit-wise "AND"
BINAND(3,4)        
0
BINCMP
Bit-wise complement
BINCMP(5)
-6
BINEOR
Bit-wise Exclusive Or
BINEOR(3,5)
6
BINEQV
Bit-wise Equivalence
BINEQV(3,5)
-7
BINIMP
Bit-wise Implication
BINIMP(3,5)
-3
BINIOR
Bit-wise "OR"
BINIOR(3,4)
7
BIT
Bit-wise test
BIT(4,2)
1
ROTATE
Bit-wise rotation
ROTATE(3,-4)
48
SHIFT
Bit-wise logical shift        
SHIFT(3,-4)
48