About Lesson
do-while Loop
The do-while loop is similar to while, but the code block is executed at least once before the condition is checked.
Syntax:
JavaScript
do {
// Code to be executed
} while (condition);
Example:
JavaScript
let i = 0;
do {
console.log(i);
i++;
} while (i < 5);