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.

For-each over an array in JavaScript

How can I loop through all the entries in an array using JavaScript? I thought it was something like this: …

javascript arrays loops foreach iteration
Loop through an array in JavaScript

In Java you can use a for loop to traverse objects in an array as follows: String[] myStringArray = {"Hello", "World"}; …

javascript arrays loops for-loop
Iterate through a HashMap

What's the best way to iterate over the items in a HashMap?

java loops hashmap iteration
Accessing the index in 'for' loops?

How do I access the index in a for loop like the following? ints = [8, 23, 45, 12, 78] for i in ints: print('item #{} = {}…

python loops list
How do I loop through or enumerate a JavaScript object?

I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; Now I want to …

javascript loops for-loop each
Looping through the content of a file in Bash

How do I iterate through each line of a text file with Bash? With this script: echo "Start!" for p …

linux bash loops unix io
What is the best way to iterate over a dictionary?

I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?

c# dictionary loops
Iterate through object properties

How does the variable propt represent the properties of the object? It's not a built-in method or property. Why does …

javascript loops object
How do I break out of nested loops in Java?

I've got a nested loop construct like this: for (Type type : types) { for (Type t : types2) { if (some condition) { // Do …

java loops nested-loops
Ways to iterate over a list in Java

Being somewhat new to the Java language I'm trying to familiarize myself with all the ways (or at least the …

java loops collections iteration