Top "For-loop" questions

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

Python for-in loop preceded by a variable

foo = [x for x in bar if x.occupants > 1] After googling and searching on here, couldn't figure out what …

python for-loop for-in-loop
How to increment a number by 2 in a PHP For Loop

The following is a simplified version of my code: <?php for($n=1; $n<=8; $n++): ?> <p>&…

php for-loop increment
How can I use break or continue within for loop in Twig template?

I try to use a simple loop, in my real code this loop is more complex, and I need to …

php symfony for-loop twig break
Are list-comprehensions and functional functions faster than "for loops"?

In terms of performance in Python, is a list-comprehension, or functions like map(), filter() and reduce() faster than a for …

python performance for-loop list-comprehension map-function
For loop to calculate factorials

Currently I have this set of code and its meant to calculate factorials. int numberInt = int.Parse(factorialNumberTextBox.Text); for (…

c# asp.net loops for-loop factorial
Read in all csv files from a directory using Python

I hope this is not trivial but I am wondering the following: If I have a specific folder with n …

python csv for-loop numpy genfromtxt
return in for loop or outside loop

Today, someone attended me to bad use of the return keyword in Java. I had written a simple for loop …

java for-loop while-loop
How to make my custom type to work with "range-based for loops"?

Like many people these days I have been trying the different features that C++11 brings. One of my favorites is …

c++ for-loop c++11 customization
Elements order in a "for (… in …)" loop

Does the "for…in" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there …

javascript for-loop
Iteration in LaTeX

I would like to use some iteration control flow to simplify the following LaTeX code. \begin{sidewaystable} \caption{A glance …

latex for-loop iteration