Pages

Adhexa

Tuesday, August 17, 2010

For statement

The for-loop typically looks like this:

for(initialisation; condition; incrementation)
{
body/statement
}

The for statement is a loop and the parentheses consists of three parts separated by a semicolon. The first part is the initialization. The second part is the condition. The condition is executed and if it is true, the body of the loop is executed and if the condition is false the loop terminates and the statements after the for loop are executed. The third part is the incrementation step. This part is executed after the body of the for loop is executed.

No comments:

Post a Comment