Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

Reset for loop index inside block

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?
1 Solution
Chris StanyonCommented:
That's absolute fine. You can change the value of $i inside the loop without problem
gdrnecAuthor Commented:
Then my problem must be in the framework.
Thank you for your quick response.
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now