EasyManua.ls Logo

Commodore VIC-20 - Page 86

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
72
The
VIC
20
User
Guide
A+C
* 10/2 t 2
When this occurs, there
is
a fixed sequence in which operations are
processed. First comes exponentiation
(f),
followed by sign evaluation,
followed by mUltiplication and division (
*
/),
then by addition and sub-
traction
(+
-).
Operations of equal precedence are evaluated from left to
right. This order
of
operation can be overridden by the use
of
parentheses.
Any operation within parentheses
is
performed first.
For
example,
4+1 * 2
(4+1)
* 2
100
*
4/2-1
100
*
(4/2-1)
100
* (4/(2-1»
results in 6
results in
10
results in
199
results in
100
results in 400
When parentheses are present, VIC BASIC evaluates the innermost set
first, then the next innermost, and so on. Parentheses can be nested to any
level and may be used freely to clarify the order
of
operations being per-
formed in
an
expression.
RElATIONAL
OPERATORS
Relational operators represent the following conditions: greater than
(
»,
less than «), equal
(=),
not equal «
»,
greater than or equal
(>
=),
and less than or equal «
=).
1 =
5-4
14>
66
15>
=
15
A<>B
results in true
(-1)
results in false
(0)
results in true
(-1)
the result
will
depend
on the values assigned
to floating point variables
A and B
VIC BASIC arbitrarily assigns a value of 0 to a "false" condition and a
value of
-1
to a "true" condition. These 0 and
-1
values can be used in
equations.
For
example, in the expression
(1
=
1)
* 4, the equation
(1
=
1)
is
true. True equates to
-1;
therefore, the expression
is
the same as
(-1)
*
4,
which results in
-4.
You can include any relational operators within a VIC
BASIC expression. Here are some more examples.
25+(14)
66)
is
the same as 25+0
(A+(I
= 5-4» *
(15)
=
15)
is
the same as
(A-I)
*
(-1)

Other manuals for Commodore VIC-20

Related product manuals