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 trialHerman Vicens
12,540 PointsWhat is wrong here?
I'd tried this in a thousand different ways and I keep getting this: Bummer! Did you create a parameter in your method named distanceToFly?.
The parameter distanceToFly was created. Either the error is misleading or there is something I can't see. Please help!!
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public EatFly(bool distanceToFly)
{
}
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
}
}
6 Answers
Michael Clark
16,324 PointsTry
public bool EatFly(int distanceToFly){
}
Robert Silva
6,450 Pointsnamespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
public bool EatFly(int distanceToFly)
{
if(distanceToFly <= TongueLength)
{
return true;
}
return false;
}
}
}
Robert Silva
6,450 PointsTry changing distanceToFly to an int.
Herman Vicens
12,540 PointsTried that already. Did not work. The message I get alludes to the missing bool type.
Herman Vicens
12,540 PointsIt did not worked. I tried that already.
Michael Clark
16,324 Pointspublic bool EatFly(int distanceToFly){ If(distanceToFly< TongueLength){ return true; } else{ return false; } }
Herman Vicens
12,540 PointsThanks everyone. And thanks to Michael Clark for the best one.
Robert Silva
6,450 PointsRobert Silva
6,450 PointsWell, did that work?