103 PRINT N$(X) the computer will print "SARDESON" . Note that the X was a variable which, in this case, had the value of 1. Here is a complete program – as far as we have got. 10 DIM N$(5) 20 N$(1)="SARDESON" 30 N$(2)="MATTINSON" 40 N$(3)="MOIR" 50 N$(4)="ALLEN" 60 N$(5)="MOUNT" 70 PRINT "WHICH ENTRY DO YOU WANT" 80 INPUT X 90 PRINT N$(X) 100 GOTO 70 We could also define an array to contain the five years of birth: 200 DIM Y(5) 210 Y(1)=1964 220 Y(2)=1960 230 Y(3)=1950 240 Y(4)=1959 250 Y(5)=1962 It would be easy to add lines to this program to make the computer search for various things.
Of course with only five entries it would undoubtedly be quickest to do the whole thing manually – but with a hundred, a thousand or a million entries the computer would be faster – and certainly more accurate. A few examples of extra lines will make the use of these arrays clearer. Delete lines 70 to 100. To print out everyone born before 1963 300 FOR X=1 TO 5 310 IF Y(X) 320 NEXT X or to print out everyone whose name contains more than five letters 400 FOR X=1 TO 5 410 J$=N$(X) 420 IF LEN (J$)>5 THEN PRINT J$ 430 NEXT