Iteration

Thus far, we have considered only one method of doing a similar thing multiple times: recursion. Any computable function can be written using recursion as the only control structure for repetition.

Sometimes, however, it is easier to think about a problem in terms of a section of code that is repeated during execution, changing variable values as it executes. This is called iteration.

We will learn several kinds of iteration constructs:

The first two are not part of Scheme, but are furnished as macros in the file initdr.scm; similar constructs are found in many programming languages.

Contents    Page-10    Prev    Next    Page+10    Index