5.Lesson 4: Control Statements - Loops
In the last lesson, you learned how to create a simple loop by using the goto statement. I advised you that this is not the best way to perform loops in C#. The information in this lesson will teach you the proper way to execute iterative logic with the various C# looping statements. Its goal is to meet the following objectives:
- Learn the while loop.
- Learn the do loop.
- Learn the for loop.
- Learn the foreach loop.
- Complete your knowledge of the break statement.
- Teach you how to use the continue statement.
There are 3 points of the loop’s basic:
Example of Initialization:
Example of Expression:
Example of Iteration: