When you use a calculator to compute 10 plus 5,
you must push:
10
+
5
=
... in exactly that order. Pushing
+
10
=
5
10
=
5
... will not work. The order is important. The same is true for computer programs.
program is a list of instructions which are followed one-by-one in the correct order.
A QBasic program consists of lines of text, one after another, like a poem. Each line of a program (or a poem) stays by itself on one line. A line which has an instruction for the computer is called a statement.
Usually the computer runs a program starting with the first statement and proceeding statement by statement until the end of the program is reached.
Here is a complete QBasic program as you see it when you are working with the QBasic system:
PRINT 10 + 5
END
The PRINT statement causes something to be printed on the screen of the computer monitor. The last statement in the program is END, which just tells the computer that the program is finished.
PRINT 10 + 5
That statement says to:
- Add the number 10 to the number 5
- Print the result on the computer monitor (the computer screen).
10
, +
, 5
, and =
. The calculator then shows 15
.