📜  kotlin for i in range 如何获取 i 的索引值 - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:32.875000             🧑  作者: Mango

代码示例1
val mylist = listOf("karate","taekwondo","sumo","boxing")
for ((index, value) in mylist.withIndex()) {
    println("the element at $index is $value")
}