2.5 for

A for loop is a fancy while loop. The general form is as follows:

'for' '('[<init-stmt>{','<init-stmt>}*] ';'
         <bexpr> ';'
         [<post-stmt>{','<post-stmt>}*]')'
  <stmt>

In this notation, <init-stmt> is an initialization statement. The notation [<init-stmt>{','<init-stmt>}*] means that there can be any number of initialization statements, separated by commas. <bexpr> is the precondition.

<post-stmt> is a post operation statement. Consequently, [<post-stmt>{,<post-stmt>}*] means any number of post operation statements, separated by commas. This sequence of statements executes after <stmt> executes (if and only if <bexpr> evalutes to true).



Copyright © 2006-09-25 by Tak Auyeung