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# C# Objects Methods Methods

Angus Eliott
Angus Eliott
3,793 Points

How To Do this!

how do you do this! i'm completely stumped!

Frog.cs
namespace Treehouse.CodeChallenges
{
    class Frog
    {
        public readonly int TongueLength;

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }
        public EatFly (int distanceToFly, bool EatFly)
        {
            if (distanceToFly > 2)
            {
                bool EatFly = true;
            }
        }
    }
}

1 Answer

Steven Parker
Steven Parker
229,644 Points

It looks like you have the right basic idea, but have a few issues. Here's some hints:

  • the return type of a method should go in front of the method's name (not with the parameters)
  • the method has only one parameter
  • this method will need to compare the argument with the "TongueLength" variable
  • you'll need to return the result of the comparison
  • you'll want to compare only variables, no fixed values
  • not counting the parameter, you should not need to create any additional variables