Loop Structure in Asp.Net.

The For loop is the most popular loop. For loops enable us to execute a series of expressions
multiple numbers of times. The For loop in ASP .NET needs a loop indexwhich counts the number of loop iterations as the loop executes. The syntax for the For loop looks like this:

For Loop (Entry Controlled loop)
for (int i = 1; i < 11; i++)
{  
               Label1.Text = i ;
            }  
While Loop (Entry Controlled loop)
  int i = 1;  
while (i < 11)
{  
Label1.Text = i;
i = i+1;
          }

Do While Loop (Exit Controlled Loop)
  int i = 1;  
Do
{
Label1.Text = i;
i=i+1; 
}
          while (i < 11)   

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *