
Concepts - 12
The NOT operator performs a logical negative of a value.
Operand 1 0001 0111 = 23
NOT Operand 1 1110 1000 = 232
Value of expression Value of NOT expression
1 –2
2 –3
–2 1
–1 0
NOTE: The NOT expression is false only if the expression evaluates to a value of – 1. If you define
Boolean constants or variables for use in your programs, use – 1 for true.
The XOR operator essentially detects the presence of a binary “1” in either operand. For example:
Operand 1 0001 0111 = 23
Operand 2 0100 1010 = 74
Operand 1 0101 1101 = 93
XOR Operand 2
Expression Evaluation
Parent hesis
The usual rules for order ar e followed in evaluating expressions. T he order of evaluation is controlled by parentheses.
Their liberal use is r ecomm ended both for err or– free code and for clarity. They ar e requir ed when mixing functional,
mathematical, logical or relational operators.
Spaces
CAM BASIC has a very forgiving attitude towards the use of spaces. They may be used almost anywhere. They must be
used after keywords. If the keyword is followed by a variable, for example, PRINTF, will give a syntax error. All spaces
are removed in the compiling process. They are added back when you type LIST.
Order
The set of arithmetic and logical operators available in CAM BASIC in the or der in which they ar e evaluated is as follows:
1. expressions in parentheses “( )”
2. $ (exponent)
3. – (unary minus)
4. * and / (multiplication and division)
5. + and – (addition and subtraction)
Komentarze do niniejszej Instrukcji