
RUN
The previous example showed a single line program. Most programs have many lines. In front of
each line, a number is first typed in. These numbers tell the computer the order in which to run the
program. When
[ENTER]
is pressed, the line is stored in the memory until the program is run. Type:
1 0 print “hello”
[ENTER]
Notice that when
[ENTER]
was pressed, hello was not printed on the screen. To do this, the word
run
has to be typed in. Type:
run
[ENTER]
You will now see hello on the screen. Note that instead of continually typing in print , you can use
the ? symbol, for example:
1 0 ? ” h e l l o ”
[ENTER]
LIST
After a program has been stored in the memory, it is possible to check what has been typed in by
listing the program. Type:
List [ENTER]
and on the screen you will see:
1 0 PRINT "hello”
which is the program stored in the memory.
Notice how the word PRINT is now in capitals. This means that the computer has accepted PRINT
as a known BASIC keyword.
Type in cls [ENTER] to clear the screen, Note that although the screen is cleared when you type in
cls [ENTER], your program is not erased from the computer’s memory.
GOTO
The GOTO keyword tells the computer to go from one line to another in order to either miss out a
number of lines or to form a loop. Type this in:
1 0 p r i n t " h e l l o "
[ENTE R]
2 0 g o t o 1 0
[ENTER]
Type:
run
[ENTER]
and you will see hell
o
printed continuously on the screen, one under another on the left side. To stop
this program running, press
[ESC]
once. To start it again, press any other key. To stop it running so
that other instructions can be typed in, press
[ESC]
twice.
Summary of Contents for CPC464
Page 1: ......
Page 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Page 118: ...TO DO DRAW THIS PAGE ...
Page 219: ...actual value may be made to vary during the execution of a program ...
Page 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Page 241: ......