
Here is how to loop on a range using for loop Kotlin for loop using indices with step

Wednesday Kotlin for loop with user defined stepīy default, the counter increases by 1, but we can change it using step as shown below kotlin for loop step example If we are interested in working with indices, we can use indices property of array. Wednesday Kotlin for loop Example with Integer array Var days = arrayOf("Sunday","Monday","Tuesday","Wednesday") Kotlin’s for loop syntax is similar to for each syntax in Java.

In this article, we will see different ways to iterate through collections in kotlin using for loop, for with indices, for loop with range and until.
