Top "For-loop" questions

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

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
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
How do I iterate over a range of numbers defined by variables in Bash?

How do I iterate over a range of numbers in Bash when the range is given by a variable? I …

bash shell for-loop syntax
C: What is the difference between ++i and i++?

In C, what is the difference between using ++i and i++, and which should be used in the incrementation block …

c for-loop post-increment pre-increment
Why is using "for...in" for array iteration a bad idea?

I've been told not to use for...in with arrays in JavaScript. Why not?

javascript arrays loops for-loop iteration
How to loop over files in directory and change path and add suffix to filename

I need to write a script that starts my program with different arguments, but I'm new to Bash. I start …

bash for-loop filenames glob
Excel VBA - exit for loop

I would like to exit my for loop when a condition inside is met. How could I exit my for …

excel vba for-loop
How to get the selected radio button’s value?

I’m having some strange problem with my JS program. I had this working properly but for some reason it’…

javascript html for-loop radio-button
How to iterate through two lists in parallel?

I have two iterables in Python, and I want to go over them in pairs: foo = (1, 2, 3) bar = (4, 5, 6) for (f, b) …

python list for-loop iterator
Iterate all files in a directory using a 'for' loop

How can I iterate over each file in a directory using a for loop? And how could I tell if …

windows batch-file for-loop cmd