intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 4.15 DESCRIPTION OF STATEMENTS COMMENTS ON IF-THEN-ELSE- Version 1.1 is not compatible with V1.0 when the IF _ THEN _ ELSE STATEMENT is used with multiple statements per line. In V1.0, the following two examples would function in the same manner. EXAMPLE 1: 10 IF A=B THEN C=A : A=A/2 : GOTO 100 20 PRINT EXAMPLE 2: 10 IF A=B THEN C=A 12 A=A/2 14 GOTO 100 20 PRINT They function in the same manner because V1.0 treats the delimiter (:) exactly the same as a carriage return (cr) in every case. However, V1.1 executes the remainder of the line if and only if the test A = B proves to be true.

This means in EXAMPLE 1 IF A did equal B, V1.1 would then set C=A, then set A = A/2, then execute line 100. IF A did not equal B, V1.1 would then PRINT A and ignore the statements C=A: A=A/2: GOTO 100. V1.1 will execute EXAMPLE 2 exactly the same way as V1.0. This same logical interpretation holds true for the ELSE statement as well. This example dictates a simple rule for maintaining IF _ THEN FLSE compatibility between the two versions. IF THE DELIMITER (:) IS NOT USED IN AN IF_THEN ELSE STATEMENT, V1.0 AND V1.1 WILL TREAT THE STATEMENTS IN THE SAME MANNER!!

This change was made because most users of MCS BASIC-52 felt that the V1.1 interpretation of this statement was more useful because fewer GOTO statements need be employed in a typical program. - 46 -