35
It is as though an empty line has replaced the previous one.
OUTPUT- PRINT
Note how useful the PRINT statement is. You can PRINT text by using quotes or apostrophes:
PRINT "Chocolate bars"
You can print the values of variables (contents of pigeon holes) by typing statements such as:
PRINT bars
without using quotes.
You will see later how very versatile the PRINT statement can be in SuperBASIC. It will enable you to
place text or other output on the screen exactly where you want it. But for the present these two
facilities are useful enough:
printing of text
printing values of variables (contents of pigeon holes).
INPUT- INPUT, READ AND DATA
A carpet-making machine needs wool as input. It then makes carpets according to the current design.
If the wool is changed you may get a different carpet.
The same sort of relations exist in a computer.
However, if the data is input into pigeon holes by means of LET there are two disadvantages when
you get beyond very trivial programs:
writing LET statements is laborious
changing such input is also laborious
You can arrange for data to be given to a program as it runs. The INPUT statement will cause the
program to pause and wait for you to type in something at the keyboard. First type:
NEW
so that the previous stored program (if it is still there) will be erased ready for this new one. Now type:
10 LET price = 15
20 PRINT "How many pens?"
30 INPUT pens
40 LET cost = price * pens
50 PRINT cost
RUN
The program pauses at line 30 and you should type the number of pens you want, say: