Top "For-loop" questions

A for loop is a control structure used by many programming languages to iterate over a range.

Which loop is faster, while or for?

You can get the same output with for and while loops: While: $i = 0; while ($i <= 10){ print $i."\n"; $i++; }; …

performance for-loop while-loop
Skip over a value in the range function in python

What is the pythonic way of looping through a range of numbers and skipping over one value? For example, the …

python loops for-loop range
How to frame two for loops in list comprehension python

I have two lists as below tags = [u'man', u'you', u'are', u'awesome'] entries = [[u'man', u'thats'],[ u'right',u'awesome']] I want to extract …

python list for-loop list-comprehension
Performance of FOR vs FOREACH in PHP

First of all, I understand in 90% of applications the performance difference is completely irrelevant, but I just need to know …

php arrays performance foreach for-loop
Exiting out of a FOR loop in a batch file?

Why does this batch file never break out of the loop? For /L %%f In (1,1,1000000) Do @If Not Exist %%f …

batch-file for-loop break
++i or i++ in for loops ??

Possible Duplicate: Is there a performance difference between i++ and ++i in C++? Is there a reason some programmers write ++…

c++ for-loop post-increment pre-increment
Iterating a JavaScript object's properties using jQuery

Is there a jQuery way to perform iteration over an object's members, such as in: for (var member in obj) { ... } …

javascript jquery for-loop iteration
How do I write a for loop in bash

I'm looking for the basic loop like: for(int i = 0; i < MAX; i++) { doSomething(i); } but for bash.

bash for-loop iterator
for or while loop to do something n times

In Python you have two fine ways to repeat some action more than once. One of them is while loop …

python performance loops for-loop while-loop
Are one-line 'if'/'for'-statements good Python style?

Every so often on here I see someone's code and what looks to be a 'one-liner', that being a one …

python for-loop if-statement idioms