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 trialAmit Ghosh
9,314 PointsdistanceToFly
I am redoing this the 2nd time and pretty sure I am right. Any suggestions please!!
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
public bool EatFly( int distanceToFly )
{
return TongueLength >= distanceToFly;
}
}
}
2 Answers
andren
28,558 PointsYour code is fine. This is just a case of the challenge checker being extremely picky about how your code looks.
The "problem" is that you have a space between the parameter and the parenthesis enclosing it, if you have it flush against the parenthesis like this:
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
public bool EatFly(int distanceToFly) // Removed space before and after parameter
{
return TongueLength >= distanceToFly;
}
}
}
Then your code will be accepted. Note of course that in reality, it does not matter whether you have a space around the parameter or not. It is completely valid C# code either way.
Amit Ghosh
9,314 PointsYeah thanks Andren, it really gets to you when you know you are right but cant spot the aberration.