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 trialHamilton Mtungwazi
1,868 Pointsafter i compile game.cs,i get a response telling me point 0,2 is not on the map...but its not true
https://w.trhou.se/jdvhc1u21r check it out,
1 Answer
Steven Parker
231,198 PointsWhen building the project I got this message:
MapLocation.cs(8,12): warning CS0642: Possible mistaken empty statement
And when I looked in Maplocation.cs, on line 7 I found a stray semicolon at the end of the line after the conditional expression.
That was causing the code block below it to be executed every time, regardless of the condition.
Hamilton Mtungwazi
1,868 PointsHamilton Mtungwazi
1,868 PointsThanks! i removed the semicolon and it worked
Kent Γ svang
18,823 PointsKent Γ svang
18,823 PointsGood job. I tried to debug this for a couple of hours yesterday. Those damn semicolons are so easy to overlook, I didn't even consider the bug to be this simple.
Steven Parker
231,198 PointsSteven Parker
231,198 PointsThe compiler messages can save you a lot of time, but you need to get into the habit of checking both above and below the line number they point to.