Question: A criticism of the break statement and the continue statement is that each is unstructured. Actually, these statements can always be replaced by structured statements,
A criticism of the break statement and the continue statement is that each is unstructured. Actually, these statements can always be replaced by structured statements, although doing so can be awkward. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. The break statement exits a loop from the body of the loop. The other way to exit is by failing the loop-continuation test. Consider using in the loop- continuation test a second test that indicates “early exit because of a ‘break’ condition.” Use the technique you develop here to remove the break statement from the application in Fig. 5.13.
Step by Step Solution
3.29 Rating (175 Votes )
There are 3 Steps involved in it
A loop can be written without a break by placing in the loopcontinuation test a se... View full answer
Get step-by-step solutions from verified subject matter experts
