Top "While-loop" questions

A while loop is a control structure used in many programming languages to continuously execute a set of instructions as long as a particular condition is met.

Using row count from a temporary table in a while loop SQL Server 2008

I'm trying to create a procedure in SQL Server 2008 that inserts data from a temp table into an already existing …

sql-server sql-server-2008 while-loop temp-tables rowcount
Reading text-file until EOF using fgets in C

what is the correct way to read a text file until EOF using fgets in C? Now I have this (…

c while-loop fgets
What is the most efficient loop in c#

There are a number of different way to accomplish the same simple loop though the items of an object in …

c# loops for-loop foreach while-loop
Creating a Magic Square in java

I have to write a program that takes in an odd number from the user and creates a magic square. …

java arrays while-loop magic-square
Which is better practice - for loop with break or conditional loop?

I'm just curious what peoples' thoughts are on this topic. Let's say I have an Array of Objects, and I …

loops for-loop while-loop language-agnostic
Python 'while' with two conditions: "and" or "or"

This is a very simple dice roll program that keeps rolling two dice until it gets double sixes. So my …

python while-loop boolean multiple-conditions
Why use a "do while" loop?

I've never understood why using a do while loops is necessary. I understand what they do, Which is to execute …

language-agnostic while-loop do-while
What's the difference between "while 1" and "while True"?

I've seen two ways to create an infinite loop in Python: while 1: do_something() while True: do_something() Is there …

python while-loop infinite-loop
Why piping input to "read" only works when fed into "while read ..." construct?

I've been trying to read input into environment variables from program output like this: echo first second | read A B ; …

bash while-loop pipe piping
Thread.sleep() in a while loop

I notice that NetBeans is warning me about using Thread.sleep() in a while loop in my Java code, so …

java while-loop sleep