Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

106 At the start of this chapter we set up a string array with the statement DIM N$(5) . This contains six elements, N$(0) to N$(5) . The length of each string element is limited to the usual 255 characters but you can have as many elements as you wish and as many dimensions – just as for numeric arrays. String arrays are even more ravenous for memory than numeric arrays – use them sparingly! Just to make sure that the various possibilities are clear, here is a program to set up a string array with first names as well as last names. The program reads names and dates into two arrays:

10 DIM Y(4,2) 20 DIM N$(4,2) 30 FOR COLUMN=0 TO 4 40 FOR ROW=0 TO 2 50 READ Y(COLUMN, ROW) 60 NEXT ROW 70 FOR ROW=0 TO 2 80 READ N$(COLUMN, ROW) 90 NEXT ROW 100 NEXT COLUMN 500 DATA 21,2,1964, JAMES,C,SARDESON 510 DATA 12,2,1960,A, MICHAEL, MATTINSON 520 DATA 4,12,1960,CHARLES,C,MOIR 530 DATA 24,10,1959,STEPHEN,R, ALLEN 540 DATA 19,12,1962, GAVIN,,MOUNT