Loops
Execute code blocks repeatedly using for, foreach, while, and do...while loops.
Loops are constructions that allow us to execute a block of code multiple times until a certain condition is met. We have several types of loops in C#:
The
forloopThe
foreachloopThe
whileloopThe
do...whileloop
The for loop
The syntax of the for loop consists of an initialization, a condition, and an iterator.