javaScript do while loop
JavaScript Do While loop
what is the Javascript do .. While loop?
1] The do...while loop in JavaScript is a control flow statement that continually runs a block of code until a given condition is evaluated to false.
2] While a do...while loop is similar to a while loop, the main distinction is that the code block is run at least once before the condition is verified.
Syntax :-
do
{
code executed
}
while (condition)
do :-
1] keyword starts the loop.
2] block of code executed first.
while :-
1] keyword condition that is evaluated after execute of the block of code.
2] condition evaluates true block of code executed again than condition false the loop terminates.
FlowChar :-
Do while loop
javascript do while loop
1] Example
Q. Display Number 10 to 1
Source code
Explain program :-
1] a starts at 10 .
2] loop prints value of a and decrement (a--) after each iteration
3] condition run long i greater than 0
Display Number 10 to 1
Output
JavaScript do while loop
2] Example
Q. display number 11 to 20 using do.. while loop
JavaScript do while loop
Output :-
JavaScript do while loop
3] Example
Q. user input using do while loop
JavaScript Do while loop
Output:-
JavaScript do while loop
4] Example
Q. javascript that iteration 28 times
Post a Comment