Reset for loop index inside block

Experts,
Is there any reason why I can't reset the for loop index inside the loop?
I have a piece of code that does not behave and I can only come up with that reason.

What I want to do is:
for (var i=0;i<resultSet.rowCount();i++) {
   if (some condition) {
       i = i + 4; // skip over the next four rows
   }
}

Is there any reason to believe that the above would not work?
LVL 4
gdrnecAsked:
Who is Participating?
 
Chris StanyonCommented:
That's absolute fine. You can change the value of $i inside the loop without problem
0
 
gdrnecAuthor Commented:
Then my problem must be in the framework.
Thank you for your quick response.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.