NEW 1. REM *** LOVELACE, ClZ *** 5 PRINT" '" " 1.9 PRINT: PRINT "ADA LOVELACE .. DAUGHTER OF THE POET LORD BYRON .. WAS MATHEMATICALL Y BRILLIANT, " 29 PRINT 39 PRINT "IN WHAT YEAR DID SHE WRITE HER AMAZINGLY ACCURATE DESCRIPTION OF THE FUTURE USES OF THE COMPUTER"; 49 TRAP 299 59 INPUT GUESS 69 IF GUESS=1.842 THEN GOTO 1.99 79 IF GUESS(1.842 THEN GOTO 1.1.9 89 IF GUESS}1.842 THEN GOTO 1.29 1.99 PRINT: PRINT "CONGRATULATIONS! YOU GUESSED THE YEAR CORRECTLY,":END 1.1.9 PRINT: PRINT "THAT WAS TOO EARL y, TRY AGAIN, " : GOTO 29 1.29 PRINT: PRINT" THAT WAS TOO LATE, TRY AGAIN, " : GOTO 29 299 PRINT:
PRINT "PLEASE ENTER A NUMBER ONLY, " 21.9 GOTO 29 In th e Lovelace Quiz, the placement of the PRINT messages associated with the IF-THEN statements is different from their place- ment in the Brainprobe Quiz and the Number Quiz. Thi s difference illustrates that the re is often more th an one way to achieve the same results in programmin g. computer Bugs The TRAP statement makes the Lovelace Quiz more errorproof, but it still is not perfect. Because the computer evaluates the date as a number, it will accept 1842.78 as incorrect but 1842,78 as correct. Most programs have " bugs," or problems. When you can figure out the bugs and fi x them , you have rea ll y learned to program.
Every beginner encounters many bugs and makes many mistakes. To become a better programmer, study this manual , refer to t he ATARI BASIC Reference Guide, and perhaps have a more experienced person look over your shoulder occasionally. You will learn how to identify bugs so that you can avoid simi lar mistakes in future programs. FOR·NEXT LOOP: THE COUNTING LOOP You are already familiar with the infinite GOTO loop. Another kind of loop is the FOR-NEXT loop. The FOR-NEXT loop is a counting loop, which is not infinite. Type NEW and enter the following program: 57