• Post Reply Bookmark Topic Watch Topic
  • New Topic

; expected  RSS feed

 
andrew cassato
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am working on Selection Sort and I have a method which is returning the error "; expected" when the ; is there so I am not sure what I am doing wrong but creating this fraction is not working...


the error is on line 4 and 5, same problem.

thanks in advance
 
Mohamed Sanaulla
Bartender
Posts: 3174
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a comma(,) at the end of line 3. Is it a typo? It would be better if you can provide the complete code.
 
Henry Wong
author
Sheriff
Posts: 23282
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
andrew cassato wrote:
the error is on line 4 and 5, same problem.


Yea, sometimes these types of errors are caused by errors from previous lines. If the lines look okay, it's recommended to look a few lines back.

Henry
 
andrew cassato
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:You have a comma(,) at the end of line 3. Is it a typo? It would be better if you can provide the complete code.


do'h. yea i took a variable out and forgot to remove the comma... weird that the error happens later.
thanks for your help
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
andrew cassato wrote:weird that the error happens later.

Not at all. The line ending with the comma is perfectly valid -- it could be continued with more comma-separated declarations on the next line. It's not until after that line that parser can possibly detect that something's gone awry.
 
andrew cassato
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for clearing that up
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!