for

Top  Previous  Next

Scripts > Class elements and c++ instructions > Interpreted C++ instructions > Control structures > for

Syntax

 

for ( [<initialization>] ; [<condition>] ; [<increment>] )  <statement>

 

Description

 

The for statement implements an iterative loop.

<condition> is checked before the first entry into the block.

<statement> is executed repeatedly UNTIL the value of <condition> is false.

 

Before the first iteration of the loop, <initialization> initializes variables for the loop.

After each iteration of the loop, <increments> increments a loop counter. Consequently, j++ is functionally the same as ++j.

 

In C++, <initialization> can be an expression or a declaration. The scope of any identifier declared within the for loop extends to the end of the control statement only. A variable defined in the for-initialization expression is in scope only within the for-block.



This page belongs to the TextTransformer Documentation

Home  Content  German