for kotlin example
Example 1: kotlin iterate array
val names = listOf("Anne", "Peter", "Jeff")
for (name in names) {
println(name)
}
Example 2: while loop kotlin
for (item in collection) print(item)
val names = listOf("Anne", "Peter", "Jeff")
for (name in names) {
println(name)
}
for (item in collection) print(item)