Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Tuesday, 9 August 2011

The for loop

For loop:
                For loop is a powerful and versatile construct. Its general form is:
for (initialization;condition;iteration)
{
//body
}
If you have only one statement to repeat then you can do this without curly braces. The for loop operates as follows:
  • When the loop starts first time, the initialization portion of the loop is executed. Generally, this is an expression that sets the value of the loop control variable, which acts as a counter that controls the loop. It is important to understand that the initialization expression is only executed once.
  • Next, condition is evaluated. This must be a Boolean expression. If this expression is true then the body of the loop is executed. If it is false the loop terminates.
  • Next, the iteration portion of the loop is executed. This is usually an expression that increments or decrements the loop control variables.
This process will continue till condition is true. See a simple java program explaining all this.

No comments:

Post a Comment

Share