loop in loop in kotlin code example
Example 1: kotlin for loop
val list = listOf("A", "B", "C")
for (element in list) {
println(element)
}
Example 2: for loop in kotlin with index
collection.forEachIndexed { index, element ->
// ...
}
val list = listOf("A", "B", "C")
for (element in list) {
println(element)
}
collection.forEachIndexed { index, element ->
// ...
}