« Happy Thanksgiving! | Main | Back in the Day »

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

Comments (3)

Peter Thomas:

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"...

sjon:

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.

DanS:

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.

About

This page contains a single entry from the blog posted on November 28, 2003 3:42 PM.

The previous post in this blog was Happy Thanksgiving!.

The next post in this blog is Back in the Day.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34