Commodore PET User Manual page 74

Table of Contents

Advertisement

String Variable
A string variable is a variable that represents a string of text.
Names for string variables have the form:
A-Z
[{~~~}]
$
Examples:
A$
M$
MN$
M1$
ZX$
F6$
Longer Variable Names
You can use variable names having more than two alphanumeric
characters; but if you do. only the first two characters cou nt. Ta PET BASIC.
therefore. BANANA and BANDAGE are the same name since bath begin with BA.
The advantage of using longer variable names is that they make programs
easer ta read. PARTNO. for example. is more meaningful than PA as a variable
name describing a part number in an inventory program.
PET BASIC allows variable names ta have up ta 255 characters.
Here are some examples of variable names with more than the minimum
number of characters:
MAGIC$
N123456789
MMM$
ABCDEF%
CALENDAR
If vou use extended variable names. keep in mind the following:
1. Only the first two characters. plus the identifier symbol. are significant in
identifying a variable. Do not use extended names like LOOP1 and
LOOP2; these refer ta the same variable: LO.
2. PET BASIC has what are called "reserved words." These are words that
have special meaning for the PET BASIC interpreter. No variable can con-
tain a reserved ward. In longer names vou have ta be very careful that a
reserved ward does not occur embedded anywhere in the name.
3. The additional characters need extra memory space. which vou might
need for longer programs.
61

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents