while loop

Solutions on MaxInterview for while loop by the best coders in the world

showing results for - "while loop"
Niko
15 Feb 2016
1Create a loop that runs as long as i is less than 10, but increase i with 2 each time.
2
3var i = 0
4
5while(i < 10){
6	console.log(i);
7    i = i + 2;
8}
Justine
12 Jan 2018
1Create a loop that runs as long as i is less than 10.
2
3var i = 0;
4
5while(i < 10) {
6	console.log(i); i++
7}
Pablo
09 Aug 2018
1var i=1;
2while(i<=10){
3document.write(i + "<br>");
4i++;}
Romina
09 Nov 2018
1
2while (condition is true) {
3
4  code to be executed;
5
6 }
7
Neele
29 Jan 2016
1A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true. 
2
3Syntax : 
4while(Boolean_expression) {
5   // Statements
6}
7Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non zero value. 
8
9When executing, if the boolean_expression result is true, then the actions inside the loop will be executed. This will continue as long as the expression result is true.
10
11When the condition becomes false, program control passes to the line immediately following the loop.
Kira
12 Feb 2020
1A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true. 
2
3Syntax : 
4while(Boolean_expression) {
5   // Statements
6}
Matthias
18 Feb 2017
1#include<stdio.h>
2
3int main()
4{
5    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
6
7    /* 
8        always declare the variables before using them 
9    */
10    int i = 0;  // declaration and initialization at the same time
11
12    printf("\nPrinting numbers using while loop from 0 to 9\n\n");
13
14    /* 
15        while i is less than 10 
16    */
17    while(i<10)
18    {
19        printf("%d\n",i);
20
21        /* 
22            Update i so the condition can be met eventually 
23            to terminate the loop 
24        */
25        i++;    // same as i=i+1;
26      }
27    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
28    return 0;
29}
Angèle
29 Aug 2018
1While(condition is true) {
2
3// Code                                         // The block keeps executing as long as the condition is true
4
5// Code
6
7}
queries leading to this page
do 2fwhile loopfor while loopdo while syntaxusing a while loopfor loop in whileloopwhile loop with orwhile loop condition should be how to define while loop while for do whilewhile loop 29 andwhile use to loopwhat is while loophow to use while loophow does the while loop worksdo while and whileexample of while loopwhile loop loopwhat does a while loop dohow do while loop workhow can a while loop be written as a for loopusing while loopssyntax of while and for loopwhile statement do e2 80 a6while statement for statement loop statement how to syntax do while 2c in while loopusing while loopwhat 27s a while loopwhy to use a do while loopdo while loop 5bwhen would you use a do while loopexplain while statementwhen we use while loopswhile loop usecan a do while loop do anything as a for loopwhile loop examplesdo while loopwhen to use while loopswhile 281 29 3b 3fhow to use a while loopdo while loop example inwhile 28 29how to use while loop inwhile 28 29 7bhow does a while loop workwhat is i in a while loopfow while loopwhile with for loopswhile loop exampleusing for loop as whilewhile loop statementwhile loops codeis do while a loopwhile loop wuses of do while loopfor loop do while loopwhile for loopwhat are while loop in programmingwhile and do while loopwhile loop example functionwhat does a while loop do 3fdo while to while loopdo while loop examplehow does while loop workwhen to use a for loop and while loopwhile loop workingwhile loop in fungwhile do whilea for loop and do while loopwhat is a do while looploop in a while statementwhile 28 29when to use for loop and while loop do while loop usagewhen to use the while loopwhile 28when to use do while loop examplewhile loop vilkoewhere we use while loophow to loop in whilehow to use the while loopwhat are while loop intended for usewhich loop to use while or forhow to write a while loophow the while loop workshow not to use a while loopwhy ever use while loopwhile 28a 5b 5d 29while loop or while loopfor loop in whilewhile loopwhile statementssyntax of do while loopwhat is do whiledo while or while dohow do while loopdo while or while loopwhile functionwhere would i use while loopswhile in while loop examplewhileloop for loop which is better to useexplain while loop with examplefor loops and while loopsdo while while dowhile 28 i 29how to code a while loopusing for loop for whilewhen do we use for loop and while loopfor loop do whilethe do while loop is considered awhat is a do while loop 3f demonstrate with an example 3fwhile loop and do while loop exampleswhile do loophow to implement do while with whilewhen is a while loopwhat does while 28i 29 dowhile do while loopwhat is a while loop used forwhy do you want to use a while loopwhat does do while loop dohow to properly do a while loopwhy we use while loopfor loop while loop do while loopwhen use while loopwhen we will use while and for loopwhat is a while loop doingwhat a while loophow to use do whilewhile wend loopwhile syntaxwhen to use for and while loopwhile loop tutorialwhile loop in for loophow while loop worksfor to while loopwhile 28i 29do while statementthe while loop is a loopwhile loop codewhat is a while loopwhile 28a 29while 28 29 3b meanswhile loopback loopwhile loops in while loopsshould i use do while loop when would you use a while loophow do while loop workswhat is a do while loopwhen to use do whilewhile loop 2a doenwhile loop condition while loopdo while loopuse of do while loopdo while loopswhen should we use while loop and for loopwhile loop 21 3dwhile 28 i 29for loop in while loopwhat is the syntax for a while loophow can i turn a while loop to a for loopwhat is correct syntax of for 2c while and do while loop 3fwhile loop programmingdo while loopwhile in whilw loop examplewhile loop 2a 3dwhy while loop is usedwhile loopsdo while loop used forcan you do a while loop in a while loopwhile loop conceptwhat are while loops used fordefine do while loopwhat is a for loop and a while loopwhile loop and for loopwhile 28 29 3aare while loops still usedcan you put 3b in while loopwhy do while loop is useddo while loop to while loopwhile cyclehow to use a do while loopuse of the while loopcan you put a while loop in a while loopdo while loop syntaxwhile 28i 3c10 29 3bwhile loop 27do while loop exampleswhile loop withwhere to use do while loop and while loopwhile loop syntaxwhen to use while loop and for loopexample while loopfor while do whileexample of do while loopwhile loops iwhile 28 3b 3b 29while and for loophow to use do while loop 28for 7cwhile 29 5c 28 28 2a 3f 29 5c 29while freadcan a while loop be written as a for loop 3fwhat is a do while loop used forwhat not to do in a while loopwhile 28i 29define while loopwhile 28i 3c 3d10 29 3bwhile loop worksdo while loopwhile definitionwhile 28 21 29when should i use a for loop or a while loopwhile 28 21 21 5b 5d 29how to make while loopcan we use while loop inside while loopwhat is do while loop with example 3ffor loops or while loop 3fwhile loop inhow to code while loopa do while loop isdo anyone use do while loopwhen to use while and for loopwhat is do while loopdo while loop is a 2fan loopmeaning of a do while loopwhen to use a for loop or a while loopwhat happens when a while loop is in a while loopwhile and do whilehow does while loop workswhat is the use of 3b in while loopcan a while loop be in a for loopwhile loop hswhat to use instead of while loopwhen to use a while loopsyntax of while loopwhile loop to for loopis do while statement a loopcan you write a for loop in a while loopwhile loop meaningdo while loop explainedwhile loops and for loopsloop whilewhile loop 3bthow to do a while loopwhen to use while loopwhen is a while loop usedbash read a file line by linewhile loop in a while loopcan there be a do while loop inside a do while loopwhen to use do while loopsyntax while loopwhat si a while loopsyntax for while loopwhile to do whilesyntax of do while loopwhen we use for loop and while loopdo while using whiole loopwhile loop in floehow to do while loop in functiondo while loop hswhen to use for loop or while loopwhen to use a while loop and a for loopdo while statemetfor loop to while loopfor loop or while loopcan you have a while loop in a while loopwhile loop definitionloop while in whiledo while loopsfor loop and while loopwhile examplewhile 28 29 7bwrite the syntax of while loop 3fhow to while loopfor and do while loopswhile loop