previous | start | next

The for Loop (Syntax 7.1 : for Statement)

Syntax 7.1 : for Statement

for (initialization_expression; condition; update_expression) statement
Example:
for (int i = 1; i <= 10; i++) sum = sum + i;
Purpose: Execute the initialization statement. While the condition remains true, execute the statement and update the expression.


previous | start | next