Kotlin – Simple Way Replace Looping “For” Like Java/C#

Some of my project is convert old project that developed use Java or C# to Kotlin. Not like Java or C#, kotlin have different “for” looping because we cant define for range manually. For example we can to this on C# or Java:

for (int i = 0; i < 10; i++) {}

we cant to that on Kotlin. Some people change it like this on kotlin:

var i = 0
while(i < 10){
++i
}

I think it take some line code.. you can change that looping with this for simple way:

for(i in 0 until 10){}

LOOP ARRAY

How about loop for array data with their index? For example we have this on Java/C#: