Index | Sololearn: Learn to code for FREE!



How does adding an index help?

12/1/2016 1:44:02 AM


2 Answers

New Answer


Index is used to find an item within an array. Be an array of objects or even to go through a String, which is an array of chars.


The point of an index is to remember where you are in a list, at a certain iteration, or in a string. Imagine you are using a function to find an item in a list for you. If you now wanted to go back and split the list in half where that item is, how would you know where to split it? Use the index in order to find the exact location.