C# C# Objects Methods Methods

joseph Bouhanef
joseph Bouhanef
476 Points

Writing Method With Bool and return Value

I'm kind of stuck this one and I can't see where it went wrong. Can someone please help me?

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

        public Frog(int tongueLength)


        {
            TongueLength = tongueLength;
        }

        public bool EatFly(TongueLength tongueLength)


        {
            bool distanceToFly = tongueLength>=distanceToFLy ;
            return distanceToFly;

        }
    }
}

1 Answer

Troy Hooker
Troy Hooker
3,281 Points

TongueLength is a property, not a type. You are trying to use TongueLength as a type in the EatFly method. You don't need to pass a tongueLength parameter to EatFly, you can use the TongueLength property instead. You do need to pass in distanceToFly:

public bool EatFly(int distanceToFly) { return TongueLength >= distanceToFly; }