Explore BrainMass

Explore BrainMass

    How to terminate infinite loops

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Discuss how a loop condition could be constructed to repeat the loop indefinitely and the loop would still terminate.

    © BrainMass Inc. brainmass.com October 9, 2019, 5:16 pm ad1c9bdddf

    Solution Preview

    This is an interesting question. The paradox is: if a loop by definition repeats indefinitely, why should it terminate?
    Trivially it might appear impossible, however, there could be at least two possible ways to make this happen.

    a) break statement:
    Use of a conditional or unconditional break statement will force any loop to ...

    Solution Summary

    A thorough treatment on how to terminate loops