When are arrays useful?

Arrays are useful when you want to store your items in a particular order. You may want ordering so you can sort the elements, or because you need to be able to fetch elements by index without iterating over the entire array.

For example, if you were storing high score data, then order matters. You would want the highest score to come first in the list (i.e. at index 0) with the next- highest score after that, and so on.

results matching ""

    No results matching ""