IF-THEN-ELSE / IF-GOTO-ELSE     
 
PURPOSE: Executes the THEN statement or GOTO statement when the specified 
condition is met. The ELSE statement is executed when the specified condition is not 
met. 
FORMAT: 
EXAMPLE:  IF A=0 THEN 300 ELSE 400 
IF K$=”Y” THEN PRINT X ELSE PRINT Y 
PARAMETERS: 
1.  Branch condition: Numeric expression truncated to an integer 
2.  Branch destination line number: integer in the range of 1≤ line number ≤65535 
3.  Program area number: single character, 0-9 
4.  Label: Name of a label in the program. 
EXPLANATION: 
1.  The statement following the THEN clause is executed, or execution jumps to 
the destination specified by the GOTO statement when the branch condition is 
met. 
2.  If the branch condition is not met, the statement following the ELSE statement 
is executed, or the program jumps to the specified branch destination. 
Execution proceeds to the next program line when the ELSE statement is 
omitted. 
3.  The format “IF A THEN –“ results in the condition being met when value of the 
expression (A) is not 0 (absolute value of A > 10
-99
). The condition is not met 
when the value of the expression is 0. 
4.  IF statements can be nested (an IF statement may contain other IF 
statements). In this case, the THEN – ELSE statements are related by their 
proximity. The GOTO – ELSE combinations have the same relationships. 
IF – THEN IF THEN – ELSE IF – THEN ELSE – ELSE – 
   
SAMPLE PROGRAM: