Sinclair QL Beginner's Manual page 12

Hide thumbs Also See for QL:
Table of Contents

Advertisement

RUN 
and the output:
105
should appear.
The advantage of this arrangement is that you can edit or add to the program with
minimal extra typing.
EDITING A PROGRAM
Later you will see the full editing features of SuperBASIC but even at this early stage you can do three
things easily:
replace a line
insert a new line
delete a line
Replace a line
Suppose you wish to alter the previous program because the price has changed to 20p for a pen.
Simply re-type line 10.
10 LET price = 20 
This line will replace the previous line 10. Assuming the other lines are still stored, test
the program by typing:
RUN 
and the new answer, 140, should appear.
Insert a new line
Suppose you wish to insert a line just before the last one, to print the words 'Total Cost.' This situation
often arises so we usually choose line numbers 10, 20, 30 ... to allow space to insert extra lines.
To put in the extra line type
35 PRINT "Total Cost" 
and it will be inserted just before line 40. The system allows line numbers in the range 1 to 32768 to
allow plenty of flexibility in choosing them. It is difficult to be quite sure in advance what changes may
be needed.
Now type:
RUN 
and the new output should be:
Total cost
140
Delete Line
You can delete line 35 by typing:

Advertisement

Table of Contents
loading

Table of Contents