Commodore PET User Manual page 76

Table of Contents

Advertisement

results in "FORWARD"
results in "HI THERE"
Arithmetic Operators
An arithmetic operator defines an arithmetic operation to be performed
on the adjoining terms. Arithmetic operations are performed using floating point
numbers Integers are converted to floating point numbers before an arithmetic
operation is performed: the result is converted back to an integer.
Arithmetic operations and their symbols are:
Addition (+). The plus sign specifies that the term on the left is to be added
to the term on the right. For numeric quantities this is straightforward addition.
Examples:
2+2
A+B+C
X%+l
BR+10E-2
The plus sign can be used to "add" strings: but rather than adding their
values, they are Joined together, or concatenated, forming one longer string. The
difference between numeric addition and string concatenation can be visualized
as follows:
Addition of Numbers:
num1 +num2=num3
Addition of Strings:
string 1+string2=string1 string2
By concatenation, strings containing up to 255 characters can be developed.
Examples:
"FOR"+"WARD"
"HI"+" "+"THERE"
A$+B$
"l"+CH$+E$
Subtraction (-). The minus sign specifies that the term to the right of the
minus sign is to be subtracted from the term to the left.
Examples:
4-1
100-64
A-B
55-142
results in 3
results in 36
results in -87
63

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents