Top "Loops" questions

Loops are a type of control flow structure in programming in which a series of statements may be executed repeatedly until some condition is met.

How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question …

php loops foreach iteration php-internals
Creating a list of objects in Python

I'm trying to create a Python script that opens several databases and compares their contents. In the process of creating …

python list object loops
How to remove elements from a generic list while iterating over it?

I am looking for a better pattern for working with a list of elements which each need processed and then …

c# list loops generics key-value
JavaScript closure inside loops – simple practical example

It outputs this: My value: 3 My value: 3 My value: 3 Whereas I'd like it to output: My value: 0 My value: 1 My …

javascript loops closures
What is the difference between range and xrange functions in Python 2.X?

Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far …

python loops range python-2.x xrange
Breaking out of nested loops

Is there an easier way to break out of nested loops than throwing an exception? (In Perl, you can give …

python loops nested-loops
Is there a "do ... until" in Python?

Is there a do until x: ... in Python, or a nice way to implement such a looping construct?

python loops
How to create an infinite loop in Windows batch file?

This is basically what I want in a batch file. I want to be able to re-run "Do Stuff" whenever …

loops batch-file infinite-loop
Loop backwards using indices in Python?

I am trying to loop from 100 to 0. How do I do this in Python? for i in range (100,0) doesn't work.

python loops
How to do something to each file in a directory with a batch script

How do you iterate over each file in a directory with a .bat or .cmd file? For simplicity please provide …

windows file loops batch-file cmd