...

/

Infinite Loops

Infinite Loops

Learn about infinite loops, their examples, and their use cases.

As already seen, a common programming mistake is creating an infinite loop. An infinite loop refers to a loop that will never exit under certain valid (or at least plausible) input. This could be because the loop variable is modified so that the exit condition is never met.

Note: Beginning programmers should be careful to examine all the possible inputs into a loop to ensure that for each such set of inputs, there is an exit condition that will eventually be reached.

Compilers, debuggers, and other programming tools can only help the programmer so far in detecting ...