In your loop i
will always be 1. You are using i + 1 for incrementing the counter variable but you are not assigning the value back.
So either you use:
for var i = 1; i < 10; i = i + 1
{
println(i)
}
or
for var i = 1; i < 10; i++
{
println(i)
}
3
solved For loop runs forever