Consider the statements:

1.

repeat untilx> 992.

x<-x+ 1

**Now Unwind the loop**:

1.

x<-x+ 12.

ifx<99then3.

x<-x+ 14.

ifx<99then5.

x<-x+ 16.

ifx<99then

:

:

In general this unravelling results in an infinite representation, not a proper one.

Iteration is where potentially unbounded computations can arise.

How could you limit the expansion to a finite number of repetitions?

Always make sure a loop has an "escape" route.

CS1104
Main Page

Last Updated 01/05/2000

©
L.Heath, 2000