go to previous page   go to home page   go to next page hear noise highlighting

Answer:

Yes


Structure Rule Five: Nesting Structures

Iteration

In flowcharting terms, any code block can be expanded into any of the structures. Or, going the other direction, if there is a portion of the flowchart that has a single entry point and a single exit point, it can be summarized as a single code block.

Rule 5 of Structured Programming: A structure (of any size) that has a single entry point and a single exit point is equivalent to a code block.

For example, say that you are designing a program to go through a list of signed integers calculating the absolute value of each one. You might (1) first regard the program as one block, then (2) sketch in the iteration required, and finally (3) put in the details of the loop body.

Or, you might go the other way. Once the absolute value code is working, you can regard it as a single code block to be used as a component of a larger program.


QUESTION 18:

(Thought question:) Would it be a good idea to implement a complicated code block as a subroutine (as a function)?


go to previous page   go to home page   go to next page