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.

Is there a way to access an iteration-counter in Java's for-each loop?

Is there a way in Java's for-each loop for(String s : stringArray) { doSomethingWith(s); } to find out how often the …

java loops for-loop foreach
Is there a better way to run a command N times in bash?

I occasionally run a bash command line like this: n=0; while [[ $n -lt 10 ]]; do some_command; n=$((n+1)); done To …

bash loops
What's the fastest way to loop through an array in JavaScript?

I learned from books that you should write for loop like this: for(var i=0, len=arr.length; i < …

javascript performance loops
How to loop through a HashMap in JSP?

How can I loop through a HashMap in JSP? <% HashMap<String, String> countries = MainUtils.getCountries(l); %> &…

java jsp loops hashmap
How to use goto statement correctly

I am taking my high school AP Computer Science class. I decided to throw a goto statement into a one …

java loops goto
Continue For loop

I have the following code For x = LBound(arr) To UBound(arr) sname = arr(x) If instr(sname, "Configuration item") …

vba loops for-loop next
How do you run a command for each line of a file?

For example, right now I'm using the following to change a couple of files whose Unix paths I wrote to …

bash loops line
How to find the most recent file in a directory using .NET, and without looping?

I need to find the most recently modified file in a directory. I know I can loop through every file …

c# .net file loops last-modified
How to remove all null elements from a ArrayList or String Array?

I try with a loop like that // ArrayList tourists for (Tourist t : tourists) { if (t != null) { t.setId(idForm); } } But …

java performance loops for-loop arraylist
Python loop that also accesses previous and next values

How can I iterate over a list of objects, accessing the previous, current, and next items? Like this C/C++ …

python loops iteration