0

Why this code for continue outputs 16?

continue function = need help for explanation I'm really confuse https://code.sololearn.com/WhqWZZ8m6nLZ/?ref=app

8th Jun 2017, 4:54 AM
peperoni
peperoni - avatar
2 Antworten
+ 5
i starts at 4. i == 6? Is 4 equal to 6? No, false. sum += 4, sum = 4. i = 5. i == 6? Is 5 equal to 6? No, false sum += 5, sum = 9 i = 6. i == 6? Is 6 equal to 6? True, Continue, i = 7. i == 6? Is 7 equal to 6? false, sum += 7, sum = 16 i = 8. 8 < 8, this is false so the loop stops. sum = 16.
8th Jun 2017, 4:57 AM
Rrestoring faith
Rrestoring faith - avatar
0
I see. very well explained. clearly understand now. hehe Thanks for the help! cheers!
8th Jun 2017, 5:04 AM
peperoni
peperoni - avatar