62
Example
:
30 IF X >25 THEN 60
If the condition X>25 is true, the computer is told to jump to line 60 (Note: the GOTO
is optional after THEN).
If the condition is not true, that is, if X is not greater than 25, then the computer simply
carries on with the normal line number order in the program. Notice that it is not necessary
to use the
ELSE
part of the command here, as this is optional.
Example:
10 INPUT A,B
20 IF A > B THEN 50
30 IF A < B THEN 60
40 IF A = B THEN 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
Содержание PreComputer Prestige
Страница 1: ...COURSE BOOK...