October 2018
Intermediate to advanced
370 pages
9h 15m
English
Another way to access elements is by using the get(index) function. Pass the index number of the list item to the get function and it will return the item from the list. intArr.get(0) and intArr[0] are the same. See the following example, where the while loop increments the index value and the get(index) function returns the item:
index = 0while(index < arraySize){ println("At index $index Value ${intArr.get(index)}") index++}
Both examples will give the same output.
Read now
Unlock full access