This documentation is archived and is not being maintained.
for Statement
Visual Studio 2005
Executes a block of statements for as long as a specified condition is true.
for (initialization; test; increment) ...statement
- initialization
-
Required. An expression. This expression is executed only once, before the loop is executed.
- test
-
Required. A Boolean expression. If test is true, statement is executed. If test if false, the loop is terminated.
- increment
-
Required. An expression. The increment expression is executed at the end of every pass through the loop.
- statement
-
Optional. Statement to be executed if test is true. Can be a compound statement.
Show: