indices

Returns the range of valid indices for the array.

val <T> Array<out T>.indices: IntRange(source)
fun main() {
    val fruits = arrayOf("Apple", "Banana", "Cherry")
    for (i in fruits.indices) {
        println("Index $i: ${fruits[i]}")
    }
}

Source