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.

Alternating color rows in PHP loop

How can I have an alternating color rows in my php loop? $num = mysql_num_rows($qPhysician); $i=0; while($i &…

php while-loop rows alternating
Converting text file to all uppercase letters

I have an assignment for class and I have to make a program that takes an existing file and converts …

java loops while-loop jgrasp
First element in a while loop?

I am writing a PHP script that imports a csv and inserts into a table but i need to get …

php loops csv while-loop fgetcsv
Best Loop Idiom for special casing the last element

I run into this case a lot of times when doing simple text processing and print statements where I am …

java loops while-loop idioms
C++ While loop, usleep()/sleep() how not to use 90% of CPU? (Ubuntu 12.04)

Suppose I have C++ code such as #include "myheaderfiles.h" //..some stuff //...some more stuff int main() { double milliseconds; int …

c++ while-loop cpu usleep
Writing a while loop in assembly

I'm trying to write a while loop in assembly with a 6502 processor and I cannot figure out how to write …

loops assembly while-loop hex 6502
Java method with return type compiles without return statement

Question 1: Why does the following code compile without having a return statement? public int a() { while(true); } Notice: If I …

java syntax while-loop compilation return
Test loops at the top or bottom? (while vs. do while)

When I was taking CS in college (mid 80's), one of the ideas that was constantly repeated was to always …

language-agnostic loops while-loop do-while
F# break from while loop

There is any way to do it like C/C#? For example (C# style) for (int i = 0; i < 100; i++) { …

f# while-loop break
'while' statement cannot complete without throwing an exception - Android

With this method I'm updating TextView every second. private void UpdatingTime(final String endTime, final long diffInDays) { new Thread(new …

java android while-loop infinite-loop