Radio Shack TRS-80 Model 100 Basic Manual page 86

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

Delete the 4 by pressing (IKIf), then insert a 2 by typing
tIl.
The program will
appear as:
10 INPUT "NUMBER"; N
.t.~0
CT -",
CT'
'+ 1.
~
:3~!l
i~
I,.)
::::
A',,/
+
N
20 IF N
=
0 THEN GOTO 604
SQ) (,01'0
l(;.i)·~
6(21 PRINT' "I\'·/ERASE It3"; AV/Cr
Although the lines are not listed in the correct order, they do have the correct line
numbers.
Exit from the Editor.
List the program. You will see:
10 INPUT "NUMBER"; N
20 IF N=0 THEN GoTo 60
30 AV = AV
+
N
40 CT = CT
+
1
:'50 GO TO 10
60 PRINT "AVERAGE IB"; AV/CT
The program is listed in the correct order, because BASIC always lists the lines in
your program according to their line numbers.
Here is an example of the execution of the program:
l\,IUMBER7
L~
"JlJM]~,E:R?
::;::
NUI"IBER7 0
AVEH/,(;[ IS 2
Ok
The program seems to be working correctly. Execute the program several times to
verify that it will work correctly in every case.
You will find that the ability to move a line in your program to a different position by
changing the line number is very useful and convenient.
80

Advertisement

Table of Contents
loading

Table of Contents