Expression evaluation – Remote Processing CAMBASIC User Manual
Page 18

Concepts - 12
The NOT oper ator 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. F or example:
Operand 1
0001 0111
=
23
Operand 2
0100 1010
=
74
Operand 1
0101 1101
=
93
XOR Ope rand 2
Expression Evaluation
Parent hesis
The usual rules for order ar e followed in evaluating expr essions. T he order of evaluation is controlled by par entheses.
Their liberal use is r ecomm ended both fo r err or– free co de and for clarity. They ar e requir ed when mixing fun ctional,
mathem atical, logical or relational operator s.
Spaces
CAM BASIC has a very forgiving attitude towards the use of spaces. They m ay be used almost anywhere. They must be
used after keywords. If the keyword is followed by a variable, for example, PRINT F, 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 arithm etic and logical operator s 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 m inus)
4.
* and / (multiplication and division)
5.
+ and – (addition and subtraction)