Get item from a position
We have an array called
items. It has 4 items.
items = ["ice cream", "chocolate", "movies", "beaches"]
If we want second item from the array then we need to do
In computer science the first position is 0 and not 1.
If we want third item then we need to do
You can see the pattern.
For the 4th item we need to do
It means that the first item of an array starts at zero and not at one.