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 *

3 + 9 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">