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 trial

C#

viktor Degerman
viktor Degerman
3,056 Points

Wats Wrong?

using System; namespace TreehouseDefense { class Point{ public readonly int X; public readonly int Y;

public Point (int x, int y){
 X=x;
 Y=y;

}
public int DistanceTo (int x, int y)
{
 int xDiff = X - x;
 int yDiff = Y - y;

 int xDiffSquared = xDiff * xDiff;
 int yDiffSquared = yDiff * yDiff;

  return (int)Math.Sqrt(xDiffSquared + yDiffSquared);


}
public int DistanceTo (Point, point){
 return DistanceTo(point.X, point,Y); 
}

}

}

ERROR: Point.cs(25,32): error CS1001: Unexpected symbol ,', expecting identifier Point.cs(25,39): error CS1001: Unexpected symbol)', expecting identifier

1 Answer

Steven Parker
Steven Parker
231,210 Points

:point_right: It looks like you have a stray comma.

In your declaration of the second version of DistanceTo, you have a spurious comma between the parameter type (Point) and name (point).