Kotlin for Loop With Index

April 8, 2019
val items = listOf("A", "B", "C")

for ((index, item) in items.withIndex()) {

}

or

items.forEachIndexed { index, item ->

}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.