W3Schools
w3schools.com โบ c โบ c_while_loop.php
C While Loop
Loops are handy because they save time, reduce errors, and they make code more readable. The while loop repeats a block of code as long as a specified condition is true:
W3Schools
w3schools.com โบ python โบ python_while_loops.asp
Python While Loops
Note: remember to increment i, or else the loop will continue forever. The while loop requires relevant variables to be ready, in this example we need to define an indexing variable, i, which we set to 1.
Syntax for a single-line while loop in Bash - Stack Overflow
I am having trouble coming up with the right combination of semicolons and/or braces. I'd like to do this, but as a one-liner from the command line: while [ 1 ] do foo sleep 2 done More on stackoverflow.com
Compound Condition WHILE Loop Syntax Error - How to fixโ
You donโt capitalize while. More on reddit.com
Whats the difference between a while loop and a for loop?
Consider how the terms are used in common language: FOR For each day in July, I will practice writing loops. For every student in the class, provide a lunchtime meal. For each letter in the alphabet, write down a word beginning with that letter. For numbers in the range 1 to 10, calculate the square root. Notice that for each case, we iterate through multiple things (days in the month / students in the class / letters in the alphabet / numbers in a range). WHILE While there is still daylight, we can play football. While the music is playing, we will dance. While I am waiting, I will read a book. While my set of Pokรฉmon cards is incomplete, I will keep collecting them. Notice that in each case, something is done for as long as a condition (a "predicate") is satisfied (is "True"). In these examples, the predicates are: "There is daylight?", "The music is playing?", "I am waiting?", "The set is incomplete?". As soon as the answer is "False", the loop stops. More on reddit.com
While loop in C
I think what you're looking for is the return type from scanf in this case - if you have something like: float f; int count = scanf("%f", &f); then count will be 1 if the input was successfully converted to a float, 0 otherwise. [Note: the return value is actually a count of how many matches were successful, so if you were to do something like: int count = scanf("%s %f", s, f); and the user input "abc def", the first match would succeed, but the second would fail, so the count would be 1 in this case)] More on reddit.com
Videos
While loops in Python are easy! โพ๏ธ
while loops (video) | Flow of Control
while loops (video)
Python While Loops & For Loops | Python tutorial for Beginners
11:27
While loops in C are easy! โพ๏ธ - YouTube
12:24
Learn Java while loops in 12 minutes! โพ๏ธ - YouTube
W3Schools
w3schools.com โบ js โบ js_loop_while.asp
W3Schools.com
December 17, 2025 - While loops execute a block of code as long as a specified condition is true.
GeeksforGeeks
geeksforgeeks.org โบ c language โบ c-while-loop
while Loop in C - GeeksforGeeks
The while loop body will be executed if and only the test condition defined in the conditional statement is true. Body: It is the actual set of statements that will be executed till the specified condition is true. Updation: It is an expression that updates the value of the loop variable in each iteration. It is also not part of the syntax...
Published ย October 8, 2025
Codecademy
codecademy.com โบ forum_questions โบ 52fd04458c1ccced71000520
While Loops The Basics (While Syntax) | Codecademy
While loops continue looping โwhileโ the condition in brackets is true. Since understand is true when the while loop gets executed, it loops through the code. The last line in its block changes understand to false.
University of Utah
users.cs.utah.edu โบ ~germain โบ PPS โบ Topics โบ while_loops.html
Programming - While Loop
Generic Syntax: while ( condition is true ) do something % Note: the "something" should eventually result % in the condition being false end ยท Infinite loops: If the action inside the loop does not modify the variables being tested in the loops condition, the loop will "run" forever.
MathWorks
mathworks.com โบ matlab โบ language fundamentals โบ loops and conditional statements
while - while loop to repeat when condition is true - MATLAB
To programmatically exit the loop, use a break statement. To skip the rest of the instructions in the loop and begin the next iteration, use a continue statement. When nesting a number of while statements, each while statement requires an end keyword.
PHP
php.net โบ manual โบ en โบ control-structures.while.php
PHP: while - Manual
It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to true. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration).
Top answer 1 of 15
1695
while true; do foo; sleep 2; done
By the way, if you type it as a multiline (as you are showing) at the command prompt and then call the history with arrow up, you will get it on a single line, correctly punctuated.
$ while true
> do
> echo "hello"
> sleep 2
> done
hello
hello
hello
^C
$ <arrow up> while true; do echo "hello"; sleep 2; done
2 of 15
234
It's also possible to use sleep command in while's condition. Making one-liner looking more clean imho.
while sleep 2; do echo thinking; done
Cppreference
en.cppreference.com โบ w โบ cpp โบ language โบ while.html
while loop - cppreference.com
July 22, 2024 - ... #include <iostream> int main() { // while loop with a single statement int i = 0; while (i < 10) i++; std::cout << i << '\n'; // while loop with a compound statement int j = 2; while (j < 9) { std::cout << j << ' '; j += 2; } std::cout << '\n'; // while loop with a declaration condition ...
MDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ JavaScript โบ Reference โบ Statements โบ while
while - JavaScript | MDN
After completing the third pass, the condition n < 3 is no longer true, so the loop terminates. In some cases, it can make sense to use an assignment as a condition. This comes with readability tradeoffs, so there are certain stylistic recommendations that would make the pattern more obvious for everyone. Consider the following example, which iterates over a document's comments, logging them to the console. ... const iterator = document.createNodeIterator(document, NodeFilter.SHOW_COMMENT); let currentNode; while (currentNode = iterator.nextNode()) { console.log(currentNode.textContent.trim()); }
TutorialsPoint
tutorialspoint.com โบ cprogramming โบ c_while_loop.htm
C - While Loop
The while keyword implies that the compiler continues to execute the ensuing block as long as the expression is true. The condition sits at the top of the looping construct. After each iteration, the condition is tested.
Programiz
programiz.com โบ c-programming โบ c-do-while-loops
C while and do...while Loop
In the previous tutorial, we learned about for loop. In this tutorial, we will learn about while and do..while loop. The syntax of the while loop is: while (testExpression) { // the body of the loop } The while loop evaluates the testExpression inside the parentheses ().
W3Schools
w3schools.com โบ java โบ java_while_loop.asp
Java While Loop
Loops are handy because they save time, reduce errors, and they make code more readable. The while loop repeats a block of code as long as the specified condition is true:
GeeksforGeeks
geeksforgeeks.org โบ c language โบ c-do-while-loop
do...while Loop in C - GeeksforGeeks
Unlike the while loop, which checks the condition before executing the loop, the do...while loop checks the condition after executing the code block, ensuring that the code inside the loop is executed at least once, even if the condition is false from the start.
Published ย October 8, 2025
IBM
ibm.com โบ docs โบ en โบ app-connect โบ 11.0.0
WHILE statement
The WHILE statement evaluates a condition expression, and if it is TRUE executes a sequence of statements.