Example:
10 INPUT A,B
20 IF A > B THEN 50
30 IF A
<
B THEN 60
40 IF A = B TH EN 70
50 PRINT A; "IS GREATER THAN"; B:END
60 PRINT A; "IS LESS THAN"; B: END
70 PRINT A; "IS EQUAL TO";B
80 END
RUN
?
7
?? 3
7 IS GREATER THAN 3
Example:
40 IF P=6 THEN PRINT "TRUE" ELSE PRINT "FALSE"
In this example if P=6 the computer will print TRUE
.
Any other value will produce
a FALSE. In either case the computer will carry onto the next
line.
It is possible for more than one statement to follow the THEN or ELSE command,
a colon separates the statements
.
.
Example:
50 IF A =5 THEN PRINT "TRUE"
: S=S-3:
GOTO 90 ELSE PRINT
"FALSE":
K=K+8
So if A equals 5 the computer will print TRUE, subtract 3 from the variable S
and go to line 90. If A does not equal 5 the computer will print FALSE
,
add
8 to the variable K and then carry on with the next normal
line.
43
Need help?
Do you have a question about the PreComputer 2000 and is the answer not in the manual?