Radio Shack TRS-80 PC-3 Owner's Manual page 68

Table of Contents

Advertisement

a string variable. You cannot designate A and A$ in the same program.
Remember that simple string variables cannot exceed 7 characters in length:
A$
=
"TOTAL"
The values assigned to a variable can change during the execution of a program, taking on the values typed in or computed during
the program.
One way to assign a variable is to use the INPUT verb. In the following program, the value of A$ will change ,in
response to the data typed in answering the inquiry "WORD?". Enter this program:
10 INPUT "WORD?"; A$
20 B
=
LEN (A$)
30 PRINT "WORD
IS
".
40 END
LJ
LJ
B;"
LETTERS"
TL-
_
-
means space
Before you RUN the program, notice several new features. Line 30 of th is program exceeds the 24-character maximum of the
PC·3's display. When a line is longer than 24 characters (up to the 79-character maximum), PC-3 moves the characters to the left
as the 24-character maximum is exceeded.
Th is does not destroy the previous input.
Th is moves to the left is referred to as
horizontal scroll ing.
The second new element in this program is the use of the END statement to signal the completion of a program. END tells the
computer that the program is completed. It is always good programming practice to use an END statement.
As your programs get more complex, you may wish to review them before you begin execution. To look at your program, use the
LIST command. LIST, which can only be used in the PROgram mode, displays programs beginning with the lowest line number.
Try listing th is program:
67

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents