Check out example codes for "kotlin iterate array". It will help you in understanding the concepts better.

Code Example 1

for (x in 0..10) println(x)

Code Example 2

val array = arrayOf(1, 3, 9)
for (item in array) {
    //loops items
}
for (index in 0..array.size - 1) {
	//loops all indices
}
for (index in 0 untill array.size) {
    //loops all indices
}
for (index in array.indices) {
    //loops all indices (performs just as well as two examples above)
}

Code Example 3

val names = listOf("Anne", "Peter", "Jeff")
for (name in names) {
    println(name)
}

Learn ReactJs, React Native from akashmittal.com