Relations or comparisons used in the IF...THEN statement are the following: = Equal to

<= Less than or equal to

<> Not equal to

>= Greater than or equal to < Less than

>Greater than

Examples of how you can use conditions:

IF....

THEN A=B

IF....

THEN GOTO

IF....

THEN GOSUB

IF....

THEN PRINT

IF....

THEN INPUT

Example:

30 IF X >25 THEN 60

If the condition X>25 is true, the computer is told to go 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

20IF A > B THEN 50

30IF A < B THEN 60

40IF A = B THEN 70

50PRINT A; “IS GREATER THAN”; B:END

60PRINT A; “IS LESS THAN”; B: END

70PRINT A; “IS EQUAL TO”;B

80END

RUN

? 7 (pick a number) ?? 3 (pick a number)

7 IS GREATER THAN 3

58