Geeks With Blogs
Stephanie Grima C#, ASP.NET and my life.

For Statement


The for statement, mostly known as for loop, is a way to iterate over a range of values. It is mostly referred to as a loop since it is used as an iteration until the expression is fullfilled.
for(initialization; termination; increment)
{
     statement/s
}

  • Initialization: this is executed once, to start the loop
  • Termination: the loop stops once this expression becomes false
  • Increment: After each iteration, this incrementation is invoked. The value here is either of incrementation or decrementation
A proper example is as follows:
string result = "";
for(int i=1; i<6; i++)
{

result += "Count is: " + i;
}
Posted on Wednesday, October 29, 2008 10:54 PM C# , Java | Back to top


Comments on this post: [C#] [Java] Control Structures Part 5 : FOR Statement

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Steffi | Powered by: GeeksWithBlogs.net