Flow control: while loops
Form is while(COND) STATMENT
Best if length of loop and exit are variable
STATEMENT will be executed while COND evaluates to TRUE
Beware: Infinite loop, if COND is never false
int i=0;
while(i) {
y=y+i;
i=i+1;
}
int i=100
while(iɭ)
y=y+1;
Previous slide
Next slide
Back to first slide
View graphic version