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.

How do I skip an iteration of a `foreach` loop?

In Perl I can skip a foreach (or any loop) iteration with a next; command. Is there a way to …

c# .net loops
How do I count unique values inside a list

So I'm trying to make this program that will ask the user for input and store the values in an …

python arrays variables loops unique
Breaking out of a for loop in Java

In my code I have a for loop that iterates through a method of code until it meets the for …

java loops for-loop break
How do you create different variable names while in a loop?

For example purposes... for x in range(0,9): string'x' = "Hello" So I end up with string1, string2, string3... all equaling "Hello"

python loops variables
VBA - how to conditionally skip a for loop iteration

I have a for loop over an array. What I want to do is test for a certain condition in …

vba conditional loops
Loop through an array php

I have this array... how do you print each of the filepath and filename? What is the best way to …

php arrays printing loops
Check if key exists and iterate the JSON array using Python

I have a bunch of JSON data from Facebook posts like the one below: {"from": {"id": "8", "name": "Mary Pinter"}, "message": "…

python json loops
How to loop through key/value object in Javascript?

var user = {}; now I want to create a setUsers() method that takes a key/value pair object and initializes the …

javascript loops for-loop iteration key-value
How to loop through an associative array and get the key?

My associative array: $arr = array( 1 => "Value1", 2 => "Value2", 10 => "Value10" ); Using the following code, $v is filled with $arr's …

php loops associative-array
Python loop counter in a for loop

In my example code below, is the counter = 0 really required, or is there a better, more Python, way to get …

loops for-loop python