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.
Videos
Python While Loops & For Loops | Python tutorial for Beginners
03:51
C while loops โพ๏ธ - YouTube
While loops in Python are easy! โพ๏ธ
C Programming Tutorial 5 - While Loop - YouTube
09:08
while Loops - YouTube
11:27
While loops in C are easy! โพ๏ธ - YouTube
W3Schools
w3schools.com โบ js โบ js_loop_while.asp
W3Schools.com
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.