10 PRINT "PROGRAM FILE 45: ALTERING THE CONTROL-VARIABLE WITHIN"
20 PRINT "        A FOR-BLOCK."
30 PRINT "    ANSI STANDARD 11.2, 11.4"
40 PRINT
50 PRINT "SECTION 45.1: ALTERING THE CONTROL-VARIABLE WITHIN"
60 PRINT "        A FOR-BLOCK."
70 PRINT
80 PRINT "THIS SECTION TESTS THAT THE VALUE OF THE CONTROL-VARIABLE"
90 PRINT "MAY BE ALTERED BY STATEMENTS WITHIN THE FOR-BLOCK, AS"
100 PRINT "WELL AS UNDER THE DIRECT CONTROL OF THE FOR-STATEMENT."
110 PRINT
120 PRINT "               BEGIN TEST."
130 LET A1=3
140 LET B1=21
150 LET C1=3
160 LET T2=4
170 PRINT
180 PRINT "CONTROL VARIABLE:"
190 PRINT "SHOULD BE","ACTUAL","RESULT"
200 LET I2=A1
210 REM S1 IS ERROR SWITCH
220 LET S1=0
230 REM T1 IS LOOP COUNT
240 LET T1=0
250 FOR I1=A1 TO B1 STEP C1
260    LET T1=T1+1
270    LET M$="  OK  "
280    IF I1=I2 THEN 310
290    LET M$="FAILED"
300    LET S1=1
310    PRINT I2,I1,M$
320    IF I2 <> 9 THEN 360
330    LET I1=17
340    LET I2=17
350    PRINT "CONTROL VARIABLE ALTERED."
360    REM RE-JOIN PATHS
370    LET I2=I2+C1
380 NEXT I1
390 PRINT "LOOP EXITED"
400 LET M$="  OK  "
410 IF I1=I2 THEN 440
420 LET M$="FAILED"
430 LET S1=1
440 PRINT I2,I1,M$
450 LET M$="  OK  "
460 IF T1=T2 THEN 490
470 LET M$="FAILED"
480 LET S1=1
490 PRINT
500 PRINT "NO. TIMES THROUGH LOOP:"
510 PRINT "SHOULD BE: ";T2;"     ACTUAL: ";T1;"   RESULT: ";M$
520 PRINT
530 IF S1=0 THEN 560
540 PRINT "*** TEST FAILED ***"
550 GOTO 570
560 PRINT "*** TEST PASSED ***"
570 PRINT
580 PRINT "               END TEST."
590 PRINT
600 PRINT "END PROGRAM 45"
610 END
