next up previous contents index
Next: while () {} Up: Loops Previous: Loops   Contents   Index


Simple for () {}

  for (i=0; i<N; i++) {
    statement_1;
    statement_2;
      .....
  }
The general form
  for (initialization_statement; continuation_condition; iteration_command) {
    statement_1;
    statement_2;
       ...
  }
is analagous to that in Perl - in this, If there is only one statement to be iterated over, the matching curly braces may be omitted:
  for (i=0; i<N; i++)
    statement;