Beginner · Lesson 6 of 12

Repeating with loops

Loops apply the same steps to many values. Start with a small collection so you can follow each iteration. A loop must eventually finish; make sure its condition or sequence moves toward an end.

Try it for yourself

Run the example, then change one thing and see what happens.

13px
Main.javaYour ideas, in code.
Loading your editor…
Run your code to see the output here.
Ready to buildUTF-87 lines

Expected output

1
2
3
4
5

Make it your own

Print the numbers from 1 to 5.

A quick check

Which habit helps when learning repeating with loops?

PreviousNext lesson