Repeats a block as long as the condition is true:
while (condtion) {
// code block
}Runs the block once before checking the condition:
do {
// code block
} while (condtion);Ideal for counting or fixed number of iterations:
for (initialization; condition; updates) {
// code block
}Exits the loop entirely and does not finish the iterations even if the condition is still met:
Skips the current loop iteration and goes to the next:
What will this print?
Ask the AI if you need help understanding or want to dive deeper in any topic