THE FOR LOOP
Syntax:
For(initialization; loopContinuationCondition; increment/decrement)
Ø Initialization: initializes the loop’s control variable.
Ø LoopContinuationCondition: determines whether the loops should continue
executing.
Ø Increment/Decrement: Increments/increments the control variable
Example
Not using
the proper relational operator in the loop-continuation condition of a loop
that counts downward (such as incorrectly using i <= 1 instead of i >= 1
in a loop counting down to 1) is usually a logic error that yields incorrect
results when the program runs.

0 Comments