Loop doesn't count down


Hello. I have a problem with my loop. It has to count down in the console, but its i not doing it. It has to go from a 100 to 0 and remove always 5. At least thats what I understood.

My Code:

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


Your loop body is an empty statement - compare to syntax here:

(scroll down if you want examples)

Try to avoid guessing. If you're not sure where semi-colons go, look up the thing you're typing - in this case a for-loop


for (var i = 100; i > 0; i -= 5); // unnecessary semi-colon

see comment in code


Thank you, this helped me out :slight_smile:


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