11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

THE COMPUTER ISIMPATIENTThe computer does not wait. If you have not pressed a key by the time the computerreaches GET, it fills the variable A$ with "" (the empty string) and goes on!This is a bad feature if you want to think before you press any key. The computer doesnot wait for you to think.MAKING THE COMPUTER WAITnYou can ask the computer to keep looking at the keyboard until you press a key. Example:35 GET L$:IF L$="" THEN GOTO 35nnnThis is a good way to use GET in guessing games for entering the word or number to beguessed without the other player being able to see it.Run this program: 10REM GET20 PRINT "clrdndndn"30 PRINT " PRESS ANY KEY"40 GET K$:IF K$='"THEN 4045 PRINT "dn dn red WAITING"47 FOR T=1 TO <strong>1000</strong>:NEXT T50 PRINT"dn whtTHE KEY YOU PRESSED WAS";K$55 FORT=1 TO <strong>1000</strong>:NEXTT60 GOTO 20MAKING WORDS OUT OF LETTERSThe GET command gets one letter at a time. To make words, glue the strings.no10 REM ## BACKWARDS ##15 POKE 53281,0 :REM BLACK SCREEN20 PRINT "clrdndndn"30 PRINT "TYPE A WORD dn"31 PRINT "END IT WITH A PERIOD"35 W$="" :REM WORD STRING IS EMPTY40 GET L$:IF L$=""THEN 4050 IF L$="." THEN 80:REM TEST FOR END60 W$=L$+W$ :REM ADD LETTER TO FRONT OF WORD65 GOTO 40 :REM TO GET ANOTHER LETTER80 REM WORD IS FINISHED82 PRINT "clr dn dn dn dn grn HERE IT IS BACKWARDS"85 PRINT "dn pur sp";W$;"whf'How does the computer know when the word is all typed in? It sees a period at the end ofthe word. Line 50 tests for the period and ends the word when it finds the period.133

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

Saved successfully!

Ooh no, something went wrong!