Programs often need to repeat the same action multiple times. Printing lines, summing numbers, or reading user input until they type "quit" would be impossible to write line by line.
In this section, I'll show you how Java's loop constructs let you run a block of code repeatedly. You'll learn while, for, and do-while loops, control them with break and continue, and avoid the common mistakes that cause infinite loops and off-by-one errors.