EasyManua.ls Logo

VTech PreComputer Prestige - Page 44

VTech PreComputer Prestige
93 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
42
A condition is either TRUE or FALSE. The IF statement has a condition. 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"
The A > 90 is a condition. The PRINT "YOU ARE SMART" is the thing it does for the
true condition. In the above example, let’s give A the value 80. Would the message be
printed? No, it would not be printed because the condition is false (80 is less than 90).
Let’s try a program to compute the area of a rectangle.
Type:
NEW
10 INPUT "ENTER THE LENGTH";L
20 INPUT "ENTER WIDTH";W
30 LET A=L*W
40 PRINT "THE AREA IS";A
50 INPUT "ANOTHER? (Y/N)";R$
60 IF R$="Y" THEN 10
70 PRINT "THAT’S ALL FOLKS!"
80 END

Related product manuals