Toshiba KB-80 Computer Keyboard User Manual


 
- 34 -
IF ~ THEN ~ ELSE
Function Judges the condition, and changes the flow of the program.
Format IF <expression> THEN <statement> [ELSE <statement> ]
<line number> <line number>
IF <expression> GOTO <line number> [ELSE <statement> ]
<line number>
Term <expression>: A theoretical expression, an arithmetic expression, or a variable
<statement>: BASIC statement list
<line number>: The line number for the next execution
Explanation The flow of the program is changed according to the evaluation of <expression>.
When <expression> is true (other than 0), <statement> which follows THEN is
executed, or the execution is moved to <line number> which follows GOTO.
A line number or one or more statements can be described after THEN. However,
only the line number is specified after GOTO.
When <expression> is false (0), the THEN statement or GOTO statement are
ignored. And if there is an ELSE statement after them, it is executed.
The IF ~ THEN ~ ELSE statement can be multiplexed (nested) by writing another IF ~
THEN ~ ELSE statement in the <statement> which follows THEN and ELSE.
In this case, if the numbers of THEN statements and ELSE statements are not the
same, each ELSE statement pairs off with the nearest THEN statement.
The IF ~ THEN ~ ELSE statement is one block. Therefore, the ELSE cannot be put
on a separate line. The ELSE statement should be included in one line (max. 255
characters with the If ~ THEN).