do {
//code;
//code;
}while(condition)
let i=10
do {
console.log(i)
i++;
}
while(i>5)
let i=10
do {
console.log(i)
i++;
}
while(i>5)
A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time.
Syntax :
do {
// Statements
}while(Boolean_expression);
Notice that the Boolean expression appears at the end of the loop, so the statements in the loop execute once before the Boolean is tested.
If the Boolean expression is true, the control jumps back up to do statement, and the statements in the loop execute again. This process repeats until the Boolean expression is false.
let i = true;
do{
i= true; or // i = false;
}while(i == true);
The do...while statement creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.
The do...while statement creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.
<?php
$num=1;
do{
$num++;
echo"The number is ".$num."<br>";
}
while($num<=5);
//======output=====
/*
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
*/
?>
let i=10
do {
console.log(i)
i++;
}
while(i>5)
let i=10
do {
console.log(i)
i++;
}
while(i>5)
let i=10
do {
console.log(i)
i++;
}
while(i>5)
while True:
print("A period of time.")
# "we chatted for a while"
print("Similar: time spell stretch stint")
print("at the same time; meanwhile.")
# "he starts to draw. talking for a while"
"""
CONJUCTION :D
"""