C. The BASIC Language

Writing a program

Languages such as English are too ambiguous to be used for communication

with a computer. Instead, all instructions are given using a computer language

consisting of just a few hundred words that the computer can interpret.

Your computer comes complete with the powerful and flexible computer

language, BBC BASIC. This is composed of a number of English-like words,

which make the language easy to learn and use. (You may already be familiar

with some other computer language such as Pascal.)

In the last section you learnt that the computer can obey some commands

immediately. For example, if you type:

PRINT "Hello" RETURN

the computer displays the word Hello.

PRINT is a BBC BASIC keyword that the computer recognises. It tells the

computer to display on the screen whatever follows the PRINT statement. The

most important BASIC keywords are described in this section of the book, and

a full list of all the keywords and their meanings is given in Appendix 6.

You may already have found out what happens if you give a command to the

computer that it cannot interpret. For example, if you type:

PRINT "Hello RETURN

the computer responds with the message:

Missing "

The computer gives an error message to show that it cannot obey your

command because you have not followed the rules of the BASIC language. It is

easy to make mistakes when giving the computer instructions, and error

messages are helpful in tracking down and correcting these mistakes.

If you want the computer to carry out a calculation in BASIC, you can use

either the normal keyboard or the numeric keypad. Try:

PRINT 8+7 RETURN

C 1