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 iterate through string one word at a time in zsh

How do I modify the following code so that when run in zsh it expands $things and iterates through them …

bash while-loop zsh expansion
C Beginner: How to search for particular words in a file (line by line) in C

I need to search for two particular words in a file line by line and if they exist, print "Found!". …

c file while-loop strcmp
Find the inner-most exception without using a while loop?

When C# throws an exception, it can have an inner exception. What I want to do is get the inner-most …

c# .net exception exception-handling while-loop
Python syntax for an empty while loop

I have written this: while file.readline().startswith("#"): continue But I suspect the continue is unnecessary? What is the correct …

python while-loop
Bash loop, print current iteration?

Say you have a simple loop while read line do printf "${line#*//}\n" done < text.txt Is there an …

bash loops while-loop
Python Assign value to variable during condition in while Loop

A simple question about Python syntax. I want to assign a value from a function to a variable during the …

python while-loop variable-assignment
How do you detect when a sound file has finished?

I am playing a sound file using this code inside a broadcast receiver activity: notification.sound = Uri.parse("android.resource://…

android while-loop
Scanner input validation in while loop

I've got to show Scanner inputs in a while loop: the user has to insert inputs until he writes "quit". …

java loops while-loop java.util.scanner
Mixing files and loops

I'm writing a script that logs errors from another program and restarts the program where it left off when it …

python python-2.7 file loops while-loop
Bash: How to end infinite loop with any key pressed?

I need to write an infinite loop that stops when any key is pressed. Unfortunately this one loops only when …

bash while-loop