Loop doesn't count down


#1

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) ;
}


#2

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


#3

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

see comment in code


#4

Hello.
Thank you, this helped me out :slight_smile:


#5

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