Giving the computer a program

We’re going to learn how to enter programs into this computer.

Let’s go!

Carefully type in the lines below, including the line numbers, pressing the RETURN key after typing each line:

10 PRINT "HELLO"
20 PRINT "WHAT'S YOUR NAME?"
30 INPUT N$
40 PRINT "HELLO "; N$

When you’ve finished typing your program, enter LIST to show your program. If you’ve made any mistakes, edit the line that contains the mistake. If you’ve added extra lines you can remove them using the DELETE, for example enter DELETE 10 to delete line 10.

Run your program by entering RUN. I'll include the RUN command at the end of some of the program listings to remind you to run your programs!

Each line starts with a line number. If you make a mistake on a line you can edit it using its line number. Enter EDIT 10 to edit line 10, then press the RETURN key to finish editing.

You can type program lines in any order you like. The computer always runs the lines in the numbered order. So if you’ve deleted line 10, or you want to replace it, you can simply type it in again.

To start your program over again, enter NEW.

Mistakes in programs

If a program does not run properly, you have probably made a mistake in it. Even a typing error can stop a program running. Mistakes in programs are called bugs.

If a Syntax error occurs in your program you’ll automatically start editing the line with the mistake. Try fixing the line, press RETURN to finish editing, and RUN your program again to see if you’ve fixed the bug.

You can always view your whole program by entering LIST, and then EDIT # or DELETE # any line (replace # with the line number).

Getting rid of programs

To get rid of a program you enter the command NEW. This wipes the program from the computer’s memory.

I'll include NEW at the start of future programs to remind you to do this before you start a new program.