• Have Any Question?
  • contact@eitworld.com

csharp.net loops





  • Iteration statements enable the user to perform the same set of statements repeatedly until a specific condition is met.
  • Iteration statements also known as looping statements.
  • The statement present in the Loop body is executed repetitively until specified condition gets false as soon as condition gets false program control comes outside the loop body and the statement present immediate after the loop’s body gets executed.
  • For example if we want to print counting up to 100. To do this we have to write 100 statements but using loop we can perform this operation to write 3 or 4 lines of code.

The following diagram shows the concept of loop:

loops

In C#.Net there are following iteration or looping statements are present:

Loop Type Description
While Loop The while loop is a simple and most commonly used loop.
For Loop For Loop also repeatedly executes a block of statement until specified condition get false.
Do-While Loop do-while loop is similar to the while loop but the difference is that it checks the condition after the execution of the loop-body.


Real Time Web Analytics