Last practice for loop


Replace this line with your code.


for (var i = 100 ; i > 0; i -=5 );{console.log(i)}

why is not printing 100?


the last semi-colon:

for (var i = 100 ; i > 0; i -=5 ); <- this one

prevents the loop from executing properly, wrongly placed semi-colons can cause trouble


Executes very properly, but repeatedly doing nothing doesn't have much effect. The statement to be repeated was an empty statement. The next statement wasn't part of the loop.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.