Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDenzel Archie
8,421 PointsCompiler/Unexpected symbol
I'm having trouble identifying where the unexpected is. it says line 14, but on my workspace that line is actually just white space.
Point point = new Point(4, 2);
bool isOnMap = map.OnMap(point);
Console.WriteLine(isOnMap);
point = new Point(8, 5);
isOnMap = map.OnMap(point);
Console.WriteLine(isOnMap);
1 Answer
Steven Parker
231,198 PointsWhen I open the workspace, line 14 of Map.cs is:
public bool OnMap(Point, point)
There's a stray comma there between the parameter type and the name. Also in the same method:
- the fields inside point are "X" and "Y" (upper case) but the code has them in lower case
- the local field "Width" (capital "W") is spelled in the code as "width" (lower case "w")
- the local field "Height" (capital "H") is spelled in the code as "height" (lower case "h")
Denzel Archie
8,421 PointsOh I was looking for the error in the Game file, but should've noticed it was in Maps'. Thank You
Steven Parker
231,198 PointsSteven Parker
231,198 PointsIt might be necessary to see more of the code to analyze the issue. You can share the entire project at once if you make a snapshot of your workspace and post the link to it here.