Ask coding questions

← Back to all posts
why does it keep on saying this?
michaelASC20 (0)

It keeps on saying unexpected symbol for

for (int 5 = i; i < 10; i++); but in my eyes it looks fine everytime

pls help

Comments
hotnewtop
Coder100 (18904)

You did the statement backwards, you define the variable to the value, not the value to the variable!

for (int i = 5; i < 10; i++) {
  // code
}

also you should never close a loop with a semicolon, it renders the loop useless!

SixBeeps (5335)

The issue is that the variable is declared as int 5 = i. I believe you meant to declare it as int i = 5, because you can't have a variable named 5 😉