Talk:Learning Petit Lesson 4: Arrays/@comment-5334617-20141208132852

I think your code

@ADDFRIEND 'last valid index is MAXFRIENDS - 1 IF (INDEX >= MAXFRIENDS) THEN PRINT "ERROR: Array is full":END FRIENDS$(INDEX) = NEWFRIEND$

should be

@ADDFRIEND 'last valid index is NUMFRIENDS - 1 IF (NUMFRIENDS >= MAXFRIENDS) THEN PRINT "ERROR: Array is full":END FRIENDS$(NUMFRIENDS) = NEWFRIEND$ NUMFRIENDS = NUMFRIENDS + 1 RETURN

Though it is not necessary if there is a  executed at the beginning of the program, it is good practice to explicitly initialize every variable you use: typically, after the , there would be a line.