VTech Precomputer Power Pad Plus User Manual

Page 45

Advertising
background image

41

You can use as many input statements as you need to get all the values into your program.

Try this:

NEW

10

INPUT “GIVE ME A NUMBER”; N1

press ENTER

20

INPUT “AND ANOTHER”; N2

press ENTER

30

PRINT “I WILL ADD THEM”

press ENTER

40

C=N1+N2

press ENTER

50

PRINT “THE ANSWER IS”; C

press ENTER

Type RUN and press ENTER to see what happens.

MAKING DECISIONS

The IF statement tells the computer that it has to make a decision. It does this by comparing
two numbers, or arithmetic expressions or string variables. It uses special symbols to represent
a condition.

The symbol > means greater than.

The symbol < means less than.

The symbol = means equal to.

The symbol > = means greater than or equal to.

The symbol < = means less than or equal to.

Here are some conditions:

5 < 10 20 > 10

They are both true because

5 is less than 10

20 is greater than 10

The IF statement has a condition either TRUE or FALSE. The computer evaluates the
condition and decides that if a condition is TRUE it will do something for the TRUE condition.

Take the following:

IF A > 90 THEN PRINT “YOU ARE SMART”

Advertising