Top "For-loop" questions

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

How does a for loop work, specifically for(;;)?

Looking through some old company code, I came across a for loop that looks like this: for (;;) { //Some stuff } I …

java loops syntax for-loop iteration
Performance difference for control structures 'for' and 'foreach' in C#

Which code snippet will give better performance? The below code segments were written in C#. 1. for(int counter=0; counter<…

c# performance for-loop foreach
How to skip to next in javascript in a for-in with a while inside?

I have a short javascript code where I need to skip to next in the for loop....see below: var …

javascript for-loop for-in-loop
JavaScript - Nuances of myArray.forEach vs for loop

I've seen plenty of questions that suggest using: for (var i = 0; i < myArray.length; i++){ /* ... */ } instead of: for (var …

javascript arrays for-loop internet-explorer-8 iterator
Is it safe to remove selected keys from map within a range loop?

How can one remove selected keys from a map? Is it safe to combine delete() with range, as in the …

dictionary for-loop go
Break in nested for loops

Possible Duplicate: How to Break from main/outer loop in a double/nested loop? I have the following situation: for(…

java loops for-loop break labelled-break
Multiple do commands in a for loop: Echoing a string to a file and then redirecting to the command window

I am trying to write a batch file to iteratively execute a fortran compiled executable. Normally one would go to …

batch-file redirect for-loop dos
SQL: How do I loop through the results of a SELECT statement?

How do I loop through the results of a SELECT statement in SQL? My SELECT statement will return just 1 column …

sql loops for-loop ticket-system
How can I get the key as well as the value in an apex for loop?

I have a map object which stores <Id, String> where the Id is a contact Id, and the …

for-loop key salesforce apex-code
How to make a reverse ordered for loop in Rust?

Editor's note: This question was asked before Rust 1.0 was released and the .. "range" operator was introduced. The question's code no …

for-loop rust