Talk:Learning Petit Lesson 4b: Advanced array topics/@comment-5334617-20141209175852

There is a third way of 'deleting' data from an arbitrary place in the array, if you don't care about preserving the order of the elements.

@DELETEFRIEND FRIENDS$(INDEX)=FRIENDS$(NUMFRIENDS-1) NUMFRIENDS=NUMFRIENDS-1 RETURN

This has the advantages that

- it is fast

- the previous, faster,  subroutine will still work

- the previous, shorter, easier, and slightly faster,  will work.

The disadvantage is that the order will be shuffled, unless you delete the entry at the highest active index, or the active size of the array was just 2.