Describe in general how you’d remove any continue statement from a loop in a program and replace it with some structured equivalent. Use the technique you develop here to remove the continue statement.

What will be an ideal response?

A loop can be rewritten without a continue statement by moving all the code that appears in the body of the loop after the continue statement to an if statement that tests for the opposite of the continue condition. Thus, the code that was originally after the continue statement executes only when the if statement’s conditional ex- pression is true (i.e., the “continue” condition is false). When the “continue” condi- tion is true, the body of the if does not execute and the program “continues” to the next iteration of the loop by not executing the remaining code in the loop’s body.

Computer Science & Information Technology

You might also like to view...

A(n) _____ is a field or set of fields that uniquely identify a record.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Briefly describe how to create a summary slide.

What will be an ideal response?

Computer Science & Information Technology