A Useful Pattern
/* �Process� integer input values until (but not including) some designated stoppingValue. */
a
variable = in.readInt();
while ( variable != stoppingValue )
{
b
variable = in.readInt();
}
g
/* Do b for each integer between 1 and n. */
a
variable = 1;
while ( variable <= n )
{
b
variable = variable + 1;
}
g
Contrast with:
Previous slide
Next slide
Back to first slide
View graphic version