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.

Syntax for a single-line Bash infinite while loop

I am having trouble coming up with the right combination of semicolons and/or braces. I'd like to do this, …

bash loops while-loop
Is there a way to loop through a table variable in TSQL without using a cursor?

Let's say I have the following simple table variable: declare @databases table ( DatabaseID int, Name varchar(15), Server varchar(15) ) -- insert …

sql-server tsql loops
Syntax of for-loop in SQL Server

What is the syntax of a for loop in TSQL?

sql sql-server loops tsql syntax
Asking the user for input until they give a valid response

I am writing a program that accepts an input from the user. #note: Python 2.7 users should use `raw_input`, the …

python validation loops python-3.x user-input
How to determine the first and last iteration in a foreach loop?

The question is simple. I have a foreach loop in my code: foreach($array as $element) { //code } In this loop, …

php loops foreach
How do I break out of a loop in Perl?

I'm trying to use a break statement in a for loop, but since I'm also using strict subs in my …

perl loops break strict
Do while loop in SQL Server 2008

Is there any method for implement do while loop in SQL server 2008?

sql-server sql-server-2008 loops while-loop do-while
What is the "right" way to iterate through an array in Ruby?

PHP, for all its warts, is pretty good on this count. There's no difference between an array and a hash (…

ruby arrays loops
How to break out of jQuery each Loop

How do I break out of a jQuery each loop? I have tried: return false; In the loop but this …

jquery loops
How to iterate over a JavaScript object?

I have an object in JavaScript: { abc: '...', bca: '...', zzz: '...', xxx: '...', ccc: '...…

javascript loops object iteration javascript-objects