Lesson 5

C# Loop Statements


Objective

What is Loop in C#?
Define differents Loop Statements?
How loop works?

What is Loop in C#?

Loop means repeat a block of code until condition becomes fail. As like other programming language, C# also provides rich set of looping statements as for loop, while loop, do while loop, foreach loop etc. Loop statements widely used in every programming and as a programmer when you write real time code you need to use loop frequently. It is very important to gather looping structure and how it works very clearly, if you want to be a good programmer.

How loop works?

Every loop requires 3 conditions to execute properly.

  1. Initialization - Starting Point
  2. Increment/Decrement - Increment or decrement speed
  3. Condition - Stopping point
Loop

Topics

  1. While Loop
  2. While(True) Loop
  3. Do While Loop
  4. For Loop
  5. Foreach Loop
  6. Nested Loop
  7. Exercises

Summary

In this chapter you have learn what is loop in C#. It is just a beginning and you will know all about loop statements in next few chapters. So keep learning C# programming and next is while loop.

BackNext