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 trialJoseph Fox
3,648 PointsI am confused as to what this wants
I understand that the method is public bool EatFly(); and that it wants to have a passed parameter EatFly(int distanceToFly) but I keep getting errors. Also if it wants an INT passed in then why is the method returning a bool can I even do that?
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
public EatFly(int distanceToFly)
{
return distanceToFly;
}
}
}
1 Answer
Steven Parker
231,268 PointsThe return value of method can be different from any of its parameters (or it may have none at all).
One easy way to get a bool value to return is to compare two values to each other. This is great for this exercise, since you want the method to determine if it is possible to eat the fly, based on the distance and the length of the tongue.