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.

do-while loop in R

I was wondering about how to write do-while-style loop? I found this post: you can use repeat{} and check conditions …

r loops repeat do-while r-faq
What is the difference between i = i + 1 and i += 1 in a 'for' loop?

I found out a curious thing today and was wondering if somebody could shed some light into what the difference …

python loops numpy operators
Does return stop a loop?

Suppose I have a loop like this: for (var i = 0; i < SomeArrayOfObject.length; i++) { if (SomeArray[i].SomeValue === SomeCondition) { …

javascript loops return
What is the most "pythonic" way to iterate over a list in chunks?

I have a Python script which takes as input a list of integers, which I need to work with four …

python list loops optimization chunks
C# Iterate through Class properties

I'm currently setting all of the values of my class object Record. This is the code that I'm using to …

c# properties loops
VB.NET - How to move to next item a For Each Loop?

Is there a statment like Exit For, except instead of exiting the loop it just moves to the next item. …

vb.net loops
How do you remove an array element in a foreach loop?

I want to loop through an array with foreach to check if a value exists. If the value does exist, …

php arrays loops foreach
Loop through list with both content and index

It is very common for me to loop through a python list to get both the contents and their indexes. …

python list loops
Difference between declaring variables before or in loop?

I have always wondered if, in general, declaring a throw-away variable before a loop, as opposed to repeatedly inside the …

java performance loops variables initialization
For vs. while in C programming?

There are three loops in C: for, while, and do-while. What's the difference between them? For example, it seems nearly …

c loops for-loop while-loop