Post
Kotlin
Who to iterate the elements through an array by using for loop in kotlin?
Posted on 19th April 2024
There is no inherited for loop within Kotlin unlike Java and additional languages. Within Kotlin, for loop is utilized to iterate over arrays, ranges, maps, etc., anything that gives an iterator.
Take a look at a simple example to understand the iteration process of elements through an array by utilizing the for loop in kotlin.
Ex:
Fun main(args : Array<String>)
{
Val percentage = arrayOf(50, 65, 70, 80, 85)
for(item in percentage)
{
println(item)
}
}
STILL GOT QUERIES?