I'm confused about Loops


For my computing homework, i have to visit the code academy page on while loops and for loops and complete some tasks. I then have to print one while loop and one for loop out. I am really unsure how to do this and i would like some help please.

Isabel Heneghan


Here's the syntax for while and for loops:

for (some conditions) {
// do something;

while (some conditions) {
//do something;

A do-while is basically a while loop turned around, so it runs the code first, then checks if the conditions are true:

do {
//some stuff;
} while (some conditions);

Hope that helped! :smile: