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

Matthew Benham
Matthew Benham
823 Points

Error: Did you create a parameter in method called distanceToFly.

Where am I going wrong with this?

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

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }

        public bool EatFly(distanceToFly)
        {
            return distanceToFly <= tongueLength
        }
    }
}

1 Answer

Steven Parker
Steven Parker
231,198 Points

A parameter declaration must include both a type and a name.

You're close, but you have a few issues to fix (nothing major):

  • you forgot the declare your parameter using the int type
  • you spelled "tongueLength" (with lower-case "t") instead of "TongueLength" (capital "T")
  • you forgot the semicolon (;) at the end of the return statement