Sharp MZ-700 Series Owner's Manual page 28

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

2.2.4 BASIC Operations
In BASIC, arithmetic operations take a slightly different form than is the case with ordinary arithmetic.
The various arithmetic operators used in BASIC are shown in the table below. The priority of these
operators when they are used together within a single expression (the sequence in which the different
arithmetic operations are performed) is as indicated by the numbers in the left column of the table;
however, operators within parentheses always have the highest priority.
Arithmetic operations
Operator
Operation
Format
1
t
Exponentiation
X t Y (Indicates X
Y
; i.e., X to the Yth power.)
2
Negation
- X
3
Multiplication,
division
X X Y (X times Y), X/Y
i.e., X divided by Y)
4
Plus, minus
X + Y (X plus Y), X - Y (X minus Y)
(Example 1)
1 0
A = 3 X 8 / 4
When a series of operators with the same priority are used in
an arithmetic expression, calculations are carried out from left
to right; thus, the result of the expression at left is 6.
(Example 2)
1 0
A = 6 0 - 6 X 8 + 2----
Result is 14.
2 0
B = ( 6 0 - 6 )
X 8 + 2
Result is 434.
(Example 3)
1 0
A = 2 T 3
Assigns 2 to the 3rd power to A; result is 8.
String operations
String operations are used to create new strings of character data by concatenating (linking) two or
more shorter strings. The only operator which can be used in string operations is the " + " sign.
(Example)
P R I N T
" A B C " + " D E F " J
»
Displays the character string "ABCDEF".
26

Advertisement

Table of Contents
loading

Table of Contents