Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
The result should be 20.. isn't it?
//because the loop should count to stop at 5 after then it will count but here is( i<7)? so it will count till it goes up to 5? var sum = 0; for( i=4; i<7; i++){ if(i==6){ continue; } sum+=i; } alert(sum); /* 0+4=4; 4+4=8; 8+4=12; 12+4=16; 16+4= 20; */
6 Antworten
+ 1
i=4,sum=0
sum=0+4;
i=5,sum=4
sum=4+5;
i=6 is skipped over and i=7 doesnt pass the test neither of em gets to be added to sum, loops ends.
so sum=9
+ 1
then share the code link, there might be something else
0
But the result showing something different.. it's 16 in codeground..
0
Okay
0
It was a great mistake from my end .... Thank you so much..!
0
I posted multiple questions that's why might be happened in this way..