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 do I add a delay in a JavaScript loop?

I would like to add a delay/sleep inside a while loop: I tried it like this: alert('hi'); for(…

javascript loops sleep
How do I loop through a list by twos?

I want to loop through a Python list and process 2 list items at a time. Something like this in another …

python list loops for-loop iteration
A 'for' loop to iterate over an enum in Java

I have an enum in Java for the cardinal & intermediate directions: public enum Direction { NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, …

java loops for-loop enums
Calling remove in foreach loop in Java

In Java, is it legal to call remove on a collection when iterating through the collection using a foreach loop? …

java loops iterator foreach
How do I apply the for-each loop to every character in a String?

So I want to iterate for each character in a string. So I thought: for (char c : "xyz") but I …

java string loops foreach char
Iterating through a JSON object

I am trying to iterate through a JSON object to import data, i.e. title and link. I can't seem …

python dictionary loops
How can I loop through a C++ map of maps?

How can I loop through a std::map in C++? My map is defined as: std::map< std::string, …

c++ loops dictionary iteration idioms
For every character in string

How would I do a for loop on every character in string in C++?

c++ loops for-loop character
Pythonic way to combine FOR loop and IF statement

I know how to use both for loops and if statements on separate lines, such as: >>> a = [2,3,4,5,6,7,8,9,0] ... …

python loops if-statement for-loop
Loop through each row of a range in Excel

This is one of those things that I'm sure there's a built-in function for (and I may well have been …

excel vba loops excel-2003