Now that you have it working, there are much better ways to accomplish the same thing.
straight for loop:
then
val list = "v1 v2 v3 v4 v5 v6 v7 v8".split(" ")
for(int i = 0; i < 8; i++){
logInfo("LoopTest", "loopCounter: " + i + " size: " + list.size())
logInfo("LoopTest", "listItem: " + list.get(i))
}
end
for loop short hand:
then
val list = "v1 v2 v3 v4 v5 v6 v7 v8".split(" ")
for(i: 0..<8){
logInfo("LoopTest", "loopCounter: " + i + " size: " + list.size())
logInfo("LoopTest", "listItem: " + list.get(i))
}
end
forEach:
then
val list = "v1 v2 v3 v4 v5 v6 v7 v8".split(" ")
forEach[listItem, i |
logInfo("LoopTest", "loopCounter: " + i + " size: " + list.size())
logInfo("LoopTest", "listItem: " + listItem)
]
end
Using a List to begin with:
then
val list = newArrayList("v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8")
forEach[listItem, i |
logInfo("LoopTest", "loopCounter: " + i + " size: " + list.size())
logInfo("LoopTest", "listItem: " + listItem)
]
end
If you need to put a delay in for each time through the while loop see Design Pattern: Looping Timers.
A while loop is probably about the worst approach to doing something like this. I only mention it in case you are working up to using this while loop for a real world problem instead of just exploring the language.