Break and continue part 2

Break and Continue
31
2/2









Continue
The continue statement breaks only one iteration in the loop, and continues with the next iteration.
Result:
The value 5 is not printed, because continue skips that iteration of the loop.
What is the output of this code?
var sum=0;
for(i=4; i<8; i++) {
if (i == 6) {
continue;
}
sum += i;
}
document.write(sum);
var sum=0;
for(i=4; i<8; i++) {
if (i == 6) {
continue;
}
sum += i;
}
document.write(sum);
Comments
Post a Comment