where initialization, condition, and update are expressions. Normally, the initialization and update are assignments or function calls, and the condition is a relational expression. A typical for loop might look like this:
for (i=0; i<4; i++) { // for i from 0 to 3
checkButtons(i); // call function checkButtons with argument i
}
Here, the initialization sets the value of the variable i, the loop counter, to 0. This statement is executed only once, before the loop is entered. The condition is normally a relational expression. If it evaluates to non-zero, the body of the loop is evaluated. At the end of the loop body, the update expression is evaluated, before the condition is evaluated again, to determine whether the loop body should be executed again. Normally, the condition will be violated after the update has been evaluated a certain amount of times. The structure in the example above is most common.
initialization;
while(condition) {
statements
update
}