For Statement

The for loop executes a statement or a block of statements repeatedly until a specified expression evaluated to false. The for loop is handy for iterating over arrays and for sequential processing. In the following example, the value of int i is written to the console and i is incremented each time through the loop by 1.

Example:

using system;
class ForLoopTest
{
static void main(String []args)
{
for (int i=1;i<=5;i++)
{
Console.Writeline(i);
}
}
}

No comments:

Post a Comment