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.

LESSON 18 DATA, READ, RESTORETWO KINDS OF DATAThere are two kinds of data in your programs:1. The kind you INPUT or GET through the keyboard.10 REM FIRST KIND OF DATA20 PRINT"clr dn dn dn"30 INPUT"YOUR PET PEEVE";P$40 PRINT"dn REALLY!"50 PRINT"dn red YOU DONT LIKE dn grn"60 PRINT P$;"wht"In this program, P$ is data entered by the user as the program runs.2. The kind which is stored in the program at the time it is written.10 REM THE SECOND KIND OF DATA20 PRINT'clr dn dn dn"30 X=5740 Y$="FLAVORS"50 PRINT X;Y$In this program, X and Y$ are data stored in the program by the programmerwhen she wrote the program.STORING LOTS OF DATAIt is OK to store small amounts of data in LET statements. But it is awkward to storelarge amounts of data that way.Use the DATA statement to store large amounts of data.Use the READ statement to get the data from the DATA statement10 REM LOTS OF DATA20PRINT"clrdndndn"30 DATA SUNDAY.MONDAY.TUESDAY.WEDNESDAY,THURSDAY.FRIDAY.SATURDAY40 READ D1$:READ D2$:READ D3$:READ D4$60 PRINT D1$,D2$.D3$,D4$After the program runs, box Dl$ holds the first item in the DATA list (SUNDAY) andbox D2$ holds the second (MONDAY), etc.104

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

Saved successfully!

Ooh no, something went wrong!