Solved

Reset for loop index inside block

Posted on 2012-12-21
2
177 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 43

Accepted Solution

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

Author Closing Comment

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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

813 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

18 Experts available now in Live!

Get 1:1 Help Now