Lesson 8



The error is telling me that I am missing a ')' but I can't seem to find it. SyntaxError: missing ) after for-loop control

// Write your very own for loop!
for (var i = 100; i >= 0; i=- 5;) {


You have one semi-colon-; too many....


The semicolon after i =- 5 shouldn't be there, and console.log(i) should have a semicolon after it like this, console.log(i);
Hope this helped :slight_smile: a lot of people make these small mistakes and it can take quite a while to find them sometimes.


you should take out the equal for the lesson


I do not understand what is the reason, what is wrong?


Your loop starts by creating variable i with initial value 100. And you stated that your loop should iterate as long as i <= 0.

But 100 is not <= 0, so body of the loop will not be executed at all.

You probably wanted to use i >= 0 condition.



for ([initialization]; [condition]; [final-expression]) {

In your FOR loop condition use i >= 0


Thanks! This code was right:

for (var i = 100; i > 0; i-= 5) {


You're very welcome :slight_smile:


for(int i = 100; i > 0; i -= 5){

Above is my code but I keep getting this error.
Oops, try again. There was a problem with your syntax.
What am I doing wrong?


Nevermind...I was using int instead of var. Fixed.