collection.forEachIndexed { index, element -> // ... }
for ((index, value) in array.withIndex()) { println("the element at $index is $value") }