Solved

Reset for loop index inside block

Posted on 2012-12-21
2
174 Views
Last Modified: 2012-12-21
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?
0
Comment
Question by:gdrnec
2 Comments
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
That's absolute fine. You can change the value of $i inside the loop without problem
0
 
LVL 4

Author Closing Comment

by:gdrnec
Comment Utility
Then my problem must be in the framework.
Thank you for your quick response.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now