And They're Off
10 DIM Shopping, Days
20 GOSUB 200
30 GOTO 32767
200 SET Shopping="27"
300 FOR Days = 1 to 27
400 Shopping=Days - 1
500 NEXT Days
600 RETURN
700 GOTO 32767
32767 END
« Happy Thanksgiving! | Main | Back in the Day »
10 DIM Shopping, Days
20 GOSUB 200
30 GOTO 32767
200 SET Shopping="27"
300 FOR Days = 1 to 27
400 Shopping=Days - 1
500 NEXT Days
600 RETURN
700 GOTO 32767
32767 END
Comments
Not sure if line 700 "GOTO 32767" is required.... I would have thoughtt that the 600 "RETURN" should have takne control back to line 30 "GOTO 32767"...
Posted by: Peter Thomas | November 30, 2003 03:02 AM
I think line 200 is not needed either unless that version of BASIc cannot jump to a condition.
Ps, don't just remove the line without chaning the gosub on line-20. A common mistake.
Posted by: sjon | December 1, 2003 01:44 AM
Yup, line 200 would meet the condition of the for/next loop. Hence, the loop would not run and program execution would end.
And, as you said, since line 200 is referenced by the GOSUB, you have to have something there. In this case, a REM statement would work.
Posted by: DanS | December 1, 2003 08:04 AM