Flow control: for-next loops
Use for() when length of loop and exit are well defined
Form is:
initial value: i=0
end condition: i
increment: i=i+1
Can also nest loops to arbitrary depth
for(i=0;ii=i+1){
y=y+i;
}
for(x=0;xx=x+1){
for(y=x;yងy=y+1){
z=x+y;
}
}
Previous slide
Next slide
Back to first slide
View graphic version