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.

Break out of a while loop that contains a switch statement

I am having trouble figuring out how to break out of a loop that contains a switch statement. Break breaks …

c# while-loop break
Continue in nested while loops

In this code sample, is there any way to continue on the outer loop from the catch block? while { // outer …

c# loops while-loop continue
Check username and password in java DataBase and give wrong password message if false

i want to display an error wrong username & password after comparing entered username and password with database of users …

java sql ms-access while-loop executequery
What is a NumberFormatException and how can I fix it?

Error Message: Exception in thread "main" java.lang.NumberFormatException: For input string: "Ace of Clubs" at java.lang.NumberFormatException.forInputString(…

java arrays while-loop numberformatexception
Using scanf in a while loop

Probably an extremely simple answer to this extremely simple question: I'm reading "C Primer Plus" by Pratta and he keeps …

c while-loop equality scanf
Java How can I break a while loop under a switch statement?

I have a homework to implement a simple testing application, below is my current code: import java.util.*; public class …

java while-loop break
Write factorial with while loop python

I am new and do not know a lot about Python. Does anybody know how you can write a factorial …

python loops while-loop factorial
C++: execute a while loop until a key is pressed e.g. Esc?

Does anyone have a snippet of code that doesn't use windows.h to check for a key press within a …

c++ while-loop exit multiplatform onkeypress
Purpose of while(1); statement in C

What purpose does while(1); serve ? I am aware while(1) (no semicolon) loops infinitely and is similar to a spinlock situation. …

c while-loop
Difference between "while" and "until" in Bash

What is the real difference between while and until ? I'd like to know if it's possible to do an increasingly …

bash while-loop