Sinclair QL Beginner's Manual page 8

Hide thumbs Also See for QL:
Table of Contents

Advertisement

CHAPTER 2 - INSTRUCTING THE COMPUTER
Computers need to store data such as numbers. The storage can be imagined as pigeon holes.
Though you cannot see them, you do need to give names to particular pigeon holes. Suppose you
want to do the following simple calculation.
A dog breeder has 9 dogs to feed for 28 days, each at the rate of one tin of 'Beefo' per day. Make the
computer print (display on the screen) the required number of tins.
One way of solving this problem would require three pigeon holes for
number of dogs
number of days
total number of tins
SuperBASiC allows you to choose sensible names for pigeon holes and you may choose as shown:
dogs
You can make the computer set up a pigeon hole name it, and store a number in it with a single
instruction or statement such as:
LET dogs = 9 
This will set up an internal pigeon hole named dogs, and place in it the number 9 thus:
dogs
9
The word LET has a special meaning to SuperBASIC. It is called a keyword. SuperBASIC has many
other keywords which you will see later. You must be careful about the space after LET and other
keywords. Because SuperBASIC allows you to choose pigeon hole names with great freedom
LETdogs would be a valid pigeon hole name.
The LET keyword is optional In SuperBASIC and because of this statements like
LETdogs = 9 
are valid. This would refer to a pigeon hole called LETdogs
Just as in English, names, numbers and keywords should be separated from each other by spaces If
they are not separated by special characters.
Even if it were not necessary, a program line without proper spacing is bad style. Machines with small
memory size may force programmers into it, but that is not a problem with the QL You can check that
a pigeon hole exists internally by typing:
PRINT dogs 
The screen should display what is in the pigeon hole:
days
tins

Advertisement

Table of Contents
loading

Table of Contents