Start do(loop) at 1


Is it possible to start a do loop at an index > 0? I’m trying to do it another way, but I’m getting an error that idx does not exist in the current scope.
     if idx = 0 [skip]
     !controller : item.controller<>WaW_AI_Unit_Controller


Hey Ben,
There is a special version of do called do_idx which provides the idx variable.

!test : {1,2,3,4}
  println(item) when idx ~= 0

2 3 4


Awesome, thank you very much!


I should probably mention that it would have been more Skookum if I had done:
println(item) unless idx = 0


Does :sk: have the equivalent of “continue” in loops (e.g. when a loop item does not meet certain criteria)?


No, but it was planned.


So how would you handle the following?

     //if idx = 0 [skip] //this doesn't work


I would either reverse the conditional:

     if idx ~= 0

Or I would first make a copy of the list with the problem entries removed. This would be situational as I’d ask myself if I really want to make a copy of the list based on its size and how often I was doing it. A simple version that makes a copy and removes the first entry:

!units : @selectedUnitList!.remove_at(0)[code]


Thanks. The first approach is the one I used. I was just wondering if there was a key word, like skip, that I could use.