6.5for statement A for statement should have the following format: for (initialization; condition; update) {statements;} an empty for statement (all work is being initialized, condition judgment, the updated clause must be in the following format: for (initialization; condi
6.5 for statement
A for statement should have the following format:
For (initialization; condition; update ){
Statements;
}
An empty for statement (all work is being initialized, condition judgment, and updated in the clause) should be in the following format:
For (initialization; condition; update );
When a comma is used in the initialization or update clause of a for statement, the complexity is increased because more than three variables are used. If necessary, separate statements can be used before a for loop (initialization clause) or at the end of a for loop (update clause.
6.6 while statement
A while statement should have the following format
While (condition ){
Statements;
}
An empty while statement should have the following format:
While (condition );
6.7 do... while statement
A do-while statement should have the following format:
Do {
Statements;
} While (condition );