English
Language : 

NSB8 Datasheet, PDF (86/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
grifo®
ITALIAN TECHNOLOGY
EXPRESSIONS
Any valid combination of numeric constants, numeric variable names, operators, function calls, and
array element names is an expression (see sections FUNCTION and USING ARRAYS for complete
details concerning function calls and array element names. These are two advanced features of NSB8
which are not covered in this introductory section). A single constant, 3.14, or variable name, A, is
an expression all by itself. In contrast, long constructs such as
(NOT(3+(SQRT(X*Y) /M3-47) /8)^3
are also numeric expressions.
EXAMPLES OF LEGAL NUMERIC EXPRESSIONS
3.14
43+A
((X+2)^(Q-R))*SQRT(Z)
EXAMPLES OF ILLEGAL NUMERIC EXPRESSIONS
438,000.33
(Reason: constants cannot contain commas)
7**Y
(Reason: two operators in a row are not allowed)
((3*ABS(A))+4 (Reason: improper parentheses nesting)
ORDER OF EVALUATION OF OPERATORS
Is 7+3*2 equal to 20 or 13? This depends on whether the addition or multiplication is performed
first. For purposes of determining the order of evaluation of operators, each operator is said to have
a certain precedence. The rule for the order of evaluation is as follows: higher precedence operators
are evaluated first, and operators of equal precedence are evaluated left to right. Operators enclosed
in parentheses are evaluated before operators not enclosed in parentheses. When there are parentheses
within other parentheses, operators within the innermost parentheses are evaluated first. The
operators are listed below in order of decreasing precedence, that is operators which are higher in the
list have higher precedence than those toward the bottom of the list. Operators on the same line have
equal precedence.
NOT, -
^
*,/
+,-
=,<,>,<>,<=,>=
AND
OR
(negates a number,unary minus)
(exponentiation)
(multiplication and division)
(addition and subtraction)
(relationals)
(boolean sum)
(boolean multiplication)
Thus 7+3*2 is equal to 13, but (7+3)*2 is 20. Also, 3*8/2 is 12, -5+4 is -1 (the - is a unary minus here),
and (1=2 OR 3=1) is 0.
Page 74
NSB8
Rel. 5.10