C# C# Objects Methods Methods

Kevin Chau
Kevin Chau
5,874 Points

I don't understand what parameter they are asking is. What is a parameter?

The C# basics methods lessons breifly goes over methods and then asks you to create a method with a parameter. I feel like I've done that but I guess I'm wrong. Please assist

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

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

        public bool EatFly(DistanceToFly distanceToFly)

        { 
            int  distanceToFly = distanceToFly;
            bool IsEat = distanceToFly.tongueLength;
            return IsEat;
        }
    }
}

1 Answer

Steven Parker
Steven Parker
182,492 Points

Your parameter is "distanceToFly", and that part is OK. But it should be an "int" type instead of "DistanceToFly" (which is not a type).

Then, in the body of the method, you'll need to compare it to the tongue length. They are two separate variables and the membership operator (.) won't be used for making a comparison.