11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INSTRUCTOR NOTES 8 THE GOTO COMMAND AND THE STOP KEY uThe GOTO command allows "dumb" loops which go on forever. It also helps in flow of O1command in later programs, after the IF is introduced. It provides a slow and easyentrance for the student into the idea that the flow of command need not just go downthe list of numbered lines. , ,^For now its main use is to let programs run on for a reasonable length of time. In each \^jloop through, something can be modified.The problem is how to stop it. The STOP key does this nicely. For cases where you havemessed up the computer quite completely, pressing the STOP key may not in fact stopthe program. For example, if the program reached an INPUT command (and shows the , ,"?" and flashing cursor), pressing STOP does not stop the program. Try this. Hold STOPdown and then press the RESTORE key once or twice.t^jo^GOTO allows the bad habit of "spaghetti" programming to grow. Examples of spaghettiare shown to the students. Although some fun is had with them, make the studentconscious of the mess which undisciplined use of GOTO can make.O1^We now have three of the four major elements which lead to "real" programming. Theyare PRINT, INPUT and GOTO. Lacking is the IF, which will change the computer from \^jsome sort of a record player into a machine which can evaluate situations and makedecisions accordingly. O1QUESTIONS:W1. In this little program:10 PRINT "HI"20 GOTO 40 ^J30 PRINT "BIG"40 PRINT "DADDY" ^what.will appear in the screen when it is run?2. And this one:10 PRINT "APPLE"20 PRINT "PIE"; W30 GOTO 20 ^j3. How do you stop the program in question 2? ^J4. Write a short program which asks you your favorite movie star's name, and thenPRINTS it over and over again.48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!