Appendix VIII:
Error codes and reserved
words
Error Numbers and Error Messages
When BASIC encounters a program statement, word or variable that it cannot understand or
process, it will stop and display an error message. The form of the message will generally indicate
what went wrong - and sometimes, if the error is a typographical error during program entry, BASIC
will prompt in edit mode, with the line where the incorrect entry was made.
The most popular error to greet the inaccurate typist is the Syntax Error (number 2), and BASIC
prompts with the line to edit if encountered in program mode. In direct mode, it simply states that
an error occured, and assumes that the last line typed is visible to spot the problem.
If the ON ERROR GOTO command is included at the beginning of a program, it may refer the
computer to a given line number when detecting an error. In the following example, the computer is
referred to line 1000 when detecting an error:
1 0 O N E R R O R G O T O 1 8 0 0
program
1 0 0 0 P R I N T C H R S ( 7 ) : M O D E 2 : I N K 1 , 0 : I N K 0 , 9 : C L S : L I S T
Whereupon the CPC464 will beep, clear the current screen, change to a suitable colorir combination
for the 80 column display, and list the program ready for examination. If the error is a Syntax error
it will appear at the foot of the listing, awaiting correction in the line edit mode, although the Syntax
error message is suppressed.
Remember to END the program on the last line before 1000 if you wish to save the results on the
screen.
BASIC will not produce error messages for valid input - so it must be assumed that whenever an
error does occur, it can be traced back to an error in the form of the program, usually guided by the
message produced to help in the process of de-bugging. As with most things, you will learn most
readily from your mistakes, so make the most of the fact that the CPC464 is the most tolerant of
tutors: you will tire of trying long before the CPC464 loses its patience!
All errors generated by BASIC are listed here, in error number order. The messages produced by
BASIC are given, as well a brief description of possible causes.