IMind soft

Author's software

Development

Design

Designing

Being tested

Loop Operators: for, do and while

Operator for:

for (<act1>; <condition>; <act2>)  <execution>

act1 - assignment of the loop variable an initial value, or more variables.

During the action you can cycle - when it becomes wrong, the cycle stops.

act2 - here comes the iteration variable (e.g. the increase of the variable to 1) or other variable

 

Operators do and while

do <execution> while (<condition>)

while (<condition>) <execution>

Operators do, while serve the for loop using only the conditions, which are the same as in the for statement

Differences operator do the operator ' while ' (where there is an operator do) is that in the first verification of conditions occurs before the loop is executed, and the second operator after the loop is executed. As in the for statement, the loop executes only if the conditions are right.

 

Top.Mail.Ru