C Plus Plus for

The C++ for loop is a for loop that is used in the C++ Programming language.

Syntax
The for loop contains three things before the actual execution of code: for ( ; ; ) Three statements are written inside the for brackets, all are seperated by semicolens. Each semicolen marks the end of a statement and the beginning of the other. i=0
 * The   expression is executed once before the loop, it usually defines the variable that will be used as a counter. For example:
 * In the example above, the variable i is set to 0. If this code was not called, i might have another value from previous for statements and the result will not be as expected.

i<10
 * The  is a condition (statement) that will be evaluated each time. If the statement is true, the loop is repeated, else the loop stops, and the rest of the code is executed. The while-condition usually performs a logical operation to evaluate the value of the counter. An example of the while-condition is:
 * In the example above, the condition written is i is less than 10, meaning the statement that will be repeated will be repated as long as i is less than 10.

i++
 * The  is an expression that is executed each time before the  is evaluated. The expression usually increments a number to the counter, so that when the while-condition is evaluated, it will return false after a certain number of loop-repititions. An example on that is:
 * In the example above, 1 is incremented to the variable i on each loop's beginning. After that, the condition will be evaluated and if it is true the loop continues.

Example
A full example on the code will be: for(i=0;i<10;i++) {   } The example above repeates the expression 10 times, because it: IF (i) is still less than 10, the loop is again repeated. ELSE the loop stops.
 * 1) sets i to 0
 * 2) increments 1 to i before each loop
 * 3) evaluates if i is still less than 10 before each loop

Usage
The for loop is used to repeat something that its value is predefined. Meaning either a:
 * 1) number that is entered by the programmer
 * 2) or a variable that is set before the loop begins