// while vs do...while loops
/* while loops: check condition first. If true, execute code. */
let i = 0;
while (i < 5) {
console.log(i); // 0 1 2 3 4
i += 1;
}
/* do-while loops: execute code at least once even if condition is false.
Then check condition. If true, continue executing code. */
let j = 6;
do {
console.log(j); // 6
j += 1;
} while (j < 5);
let i = 0;
//while checking for a state
while (i < 20){
console.log(`do something while ${i} is less than 20`)
i++;
}
console.log("End of While Loop")
//for iterating a certain number of times
for(j = 0; j < 20; j++){
console.log(`do something for ${j + 1} time(s)`)
}
console.log("End of For loop")