For


#1

Another silly question but i did not find the answer in the docs.

How can i modify the step in a for loop? That is, for example in C# i can write:

for (x = 0; x < 10; x += 2)

and x is 0, 2, 4…

but i can also write x += 3, and so on.

I couldn’t find a way in Kotlin… my fault, i know…

Thx.


#2

 

for (i in 1…10 step 2)
  println(i)


#3

Gut. Thx a lot.


#4

seems like the document is outdated for a long time .