10 REM PC-BASIC test 
20 REM IF-THEN-ELSE syntax
30 OPEN "OUTPUT.TXT" FOR OUTPUT AS 1
40 ON ERROR GOTO 10000
50 A=0: PRINT#1, 50,: IF A THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
60 A=1: PRINT#1, 60,: IF A THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
65 A=1: PRINT#1, 65,: IF (1-A) THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
67 PRINT#1, 67,: IF 1+1 THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
70 PRINT#1, 70,: IF 1 THEN PRINT#1, "TRUE"
75 PRINT#1, 75,: IF 1, THEN PRINT#1, "TRUE"
80 PRINT#1, 80,: IF 1 GOTO PRINT#1, "TRUE"
85 PRINT#1, 85,: IF 1, GOTO PRINT#1, "TRUE"
90 PRINT#1, 90,: IF 0 THEN PRINT#1, "TRUE"
95 PRINT#1, 95,: IF 0, THEN PRINT#1, "TRUE"
100 PRINT#1, 100,: IF 0 GOTO PRINT#1, "TRUE"
105 PRINT#1, 105,: IF 0, GOTO PRINT#1, "TRUE"
110 PRINT#1
150 PRINT#1, 150,: IF 32768 THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
170 PRINT#1, 170,: IF 0 THEN PRINT#1, 170,: PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
175 PRINT#1, 175,: IF -1 THEN PRINT#1, 175,: PRINT#1, "TRUE" ELSE PRINT#1, "FALSE"
180 PRINT#1, 180,: IF 0 THEN PRINT#1, "TRUE": REM ELSE PRINT#1, "FALSE"
185 PRINT#1, 185,: IF -1 THEN PRINT#1, "TRUE": REM ELSE PRINT#1, "FALSE"
200 PRINT#1, 200,: IF -1 THEN IF 0 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF 0 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
210 PRINT#1, 210,: IF -1 THEN IF -1 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF 0 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
220 PRINT#1, 220,: IF -1 THEN IF 0 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF -1 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
230 PRINT#1, 230,: IF -1 THEN IF -1 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF -1 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
240 PRINT#1, 240,: IF 0 THEN IF 0 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF 0 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
250 PRINT#1, 250,: IF 0 THEN IF -1 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF 0 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
260 PRINT#1, 260,: IF 0 THEN IF 0 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF -1 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
270 PRINT#1, 270,: IF 0 THEN IF -1 THEN PRINT#1, "11" ELSE PRINT#1, "10" ELSE IF -1 THEN PRINT#1, "01" ELSE PRINT#1, "00" 
350 PRINT#1, 350,: IF 0 THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE" ELSE PRINT#1, "FFALSE"
360 PRINT#1, 360,: IF -1 THEN PRINT#1, "TRUE" ELSE PRINT#1, "FALSE" ELSE PRINT#1, "FFALSE"
500 PRINT#1, 500, IF 0 THEN 501 ELSE 502
501 PRINT#1, 501
502 PRINT#1, 502
510 PRINT#1, 510, IF -1 THEN 511 ELSE 512
511 PRINT#1, 511
512 PRINT#1, 512
520 PRINT#1, 520, IF 0 GOTO 521 ELSE 522
521 PRINT#1, 521
522 PRINT#1, 522
530 PRINT#1, 530, IF -1 GOTO 531 ELSE 532
531 PRINT#1, 531
532 PRINT#1, 532
1500 PRINT#1, 1500, IF 0 THEN 1501 ELSE 1502
1501 PRINT#1, 1501
1502 PRINT#1, 1502
1510 PRINT#1, 1510, IF -1 THEN 1511 ELSE 1512
1511 PRINT#1, 1511
1512 PRINT#1, 1512
1520 PRINT#1, 1520, IF 0 GOTO 1521 ELSE 1522
1521 PRINT#1, 1521
1522 PRINT#1, 1522
1530 PRINT#1, 1530, IF -1 GOTO 1531 ELSE 1532
1531 PRINT#1, 1531
1532 PRINT#1, 1532
2000 PRINT#1, 2000: IF 0 ELSE PRINT#1, 1
2010 PRINT#1, 2010: IF -1 ELSE PRINT#1, 1
2020 PRINT#1, 2020: IF "A" THEN PRINT#1, 1
2030 PRINT#1, 2030: IF A$ THEN PRINT#1, 1
2040 PRINT#1, 2040: IF 0 THEN ELSE PRINT#1, 1
2050 PRINT#1, 2050: IF -1 THEN ELSE PRINT#1, 1
2400 PRINT#1, 2400,: IF 0 THEN X ELSE PRINT#1, "FALSE"
2410 PRINT#1, 2410,: IF -1 THEN X ELSE PRINT#1, "FALSE"
2420 PRINT#1, 2420,: IF 0 THEN PRINT#1, "TRUE" ELSE X
2430 PRINT#1, 2430,: IF -1 THEN PRINT#1, "TRUE" ELSE X
2600 PRINT#1, 2600,: ELSE PRINT#1, "NO"
2610 PRINT#1, 2610,: THEN PRINT#1, "NO"
2620 IF 0
2630 IF -1
2640 IF 0 THEN
2630 IF -1 THEN
2640 THEN
2650 ELSE
9999 END
10000 PRINT#1, "ERROR:", ERR, ERL
10010 RESUME NEXT
