Introduction
Imagine needing to print the numbers 1 to 100. You could write 100 Console.WriteLine() statements, or you could use a loop. Loops let you repeat a block of code automatically, making your programs shorter and easier to maintain.
In this module, you learn about C#'s three loop types: the for loop, which repeats a set number of times; the while loop, which repeats as long as a condition is true; and the do-while loop, which always runs its body at least once. You also learn how to control loop behavior with break and continue.