954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

infinite loop

This is a question on one of my homework assignments and I have it narrowed down between these two but I'm not sure which one it is. Anyone know it?

To avoid an infinite loop make sure the loop body: alters the exit condition or contains at least one output statement?

dal4488
Newbie Poster
17 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Which seems to make more sense? Try them side by side.To avoid an infinite loop make sure the loop body alters the exit condition.
To avoid an infinite loop make sure the loop body contains at least one output statement.Would altering the loop exit condition affect looping? Or would an output statement affect loop operation?

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

To avoid an infinite loop, you should make sure the condition or test value is not skipped over. That's as far as I know.

thedk
Newbie Poster
1 post since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You