Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

THE FOR LOOP

 

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.

 

 

 

 

Post a Comment

0 Comments

Ad Code

Responsive Advertisement