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.

How to get out of while loop in java with Scanner method "hasNext" as condition?

I am a beginner at java programming and has run into a strange issue. Below is my code, which asks …

java loops while-loop infinite-loop
MySQL Insert with While Loop

I'm trying to create a bunch of records in my MySQL database. This is a one time creation so I …

mysql while-loop
for or while loop to do something n times

In Python you have two fine ways to repeat some action more than once. One of them is while loop …

python performance loops for-loop while-loop
Bash loop ping successful

I'm thinking that this needs to be changed to a while clause, at the moment it'll wait till all 10000 pings …

bash shell unix while-loop ping
Timer & TimerTask versus Thread + sleep in Java

I found similar questions asked here but there weren't answers to my satisfaction. So rephrasing the question again- I have …

java timer while-loop sleep task
Python loop to run for certain amount of seconds

I have a while loop, and I want it to keep running through for 15 minutes. it is currently: while True: #…

python time timer while-loop
return in for loop or outside loop

Today, someone attended me to bad use of the return keyword in Java. I had written a simple for loop …

java for-loop while-loop
How do I "read" a variable on a while loop

How can I read from variable with while read line? For example: the_list=$(..code..) while read line do echo $…

bash variables while-loop
Populate PHP Array from While Loop

If I am fetching data from a MySQL database and using a while loop to iterate through the data how …

php mysql arrays loops while-loop
Iterating over the content of a text file line by line - is there a best practice? (vs. PMD's AssignmentInOperand)

We have a Java Application that has a few modules that know to read text files. They do it quite …

java while-loop pmd