For loops practice - why wont this work?


#1

Hi,

I cant understand why this is incorrect. I've searched loads of for loops and this is the correct syntax as far as i can see.

The objective is to get the loop to count down from 100 to 0 in decrements of 5.

My code is below - the error I am getting is 'SyntaxError: Unexpected token '

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

thanks for your help!


#2

Never mind i figured it out - shouldn't have had the extra ; after 5 in the intial ()

thanks


#3

I did exactly the same thing but as I am used to seeing that error code....inner voice.....'what really you never get your code right first time?.'....i looked at the previous code written to compare and noticed the semicolon...two days ago this would have driven me nutz...had I not already been doolally! haha