• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

else if

 
levi sleight
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so. i treid to do 2 else ifs and it tells me it wont work. heres all my code







on line 36 it says "syntax error on token "else" delete this token"

p.s: im useing eclipse
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
line 34 - typo- semicolon after else if ()
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

That is line 34 on your original code. There is an extra ; character after the if - that denotes the end of the if statement, which is immediately followed by a block which is independent of the if statement, therefore the following else clause is not applicable. You should remove the ; on that line
 
levi sleight
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


thanks, im dumb
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not at all. Lots of people make that mistake.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And even with experience, we don't necessarily stop making the mistake, but all the practice we've had making it makes us better at recognizing it when it happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic