Menu

READ / DATA

2015-12-04
2015-12-05
  • Ronald Herrera

    Ronald Herrera - 2015-12-04

    Hi, again. Here is something that may interest you to correct. It’s the READ / DATA statement that makes the data in the list erased of memory somehow after a CLEAR statement or something similar causing an “Out Of Data” error. Here’s an example:

    10 'READ/DATA - CMD Ver. 20151204
    20 'SAVE "READDATA.BAS",A
    30 KEY OFF: CLEAR: CLS
    40 X = 17: DIM X$(X)
    50 FOR Z = 1 TO X
    60 READ X$(Z)
    70 PRINT Z, X$(Z)
    80 NEXT Z
    90 PRINT "LET'S DO IT AGAIN! - Press Any Key"
    100 K$ = INKEY$: IF K$ = "" THEN GOTO 100
    110 IF K$ = CHR$(27) THEN END ELSE GOTO 30
    120 '*** DATA ***
    130 DATA "DOG","CAT","SPIDER","FLY","LION","BIRD","TIGER","BEAR","SNAKE"
    140 DATA "FISH","SHARK","ANT","ROACH","WHALE","CROCODILE","WORM","BUTTERFLY"

     
  • Rob Hagemans

    Rob Hagemans - 2015-12-05

    OK, thanks! Looks like CLEAR should reset the DATA pointer in addition to the other things it does - will fix this. (Meanwhile, you can work around the bug by adding a RESTORE command to line 30)