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

Arnaldo Zayas
Arnaldo Zayas
577 Points

wondering where I'm going wrong

I've seen from other peoples questions that I could have simply written return TongueLength >= distanceToFly; in the Map class lesson the bool value was given a name so I wanted to as well, where am I going wrong in this approach?

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

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }
        public bool EatFly(int distanceToFLy)
        {
        bool inReach = TongueLength >= distanceToFly; 
            return inReach;
        }
    }
}
Arnaldo Zayas
Arnaldo Zayas
577 Points

I just got it, lol. Going to have to learn to be neater, It was a capital L in the distanceToFly paramater that had kept the code from running.

1 Answer

Steven Parker
Steven Parker
231,269 Points

One of Parker's Principles of Programming is "Typos and misspellings are the bane of tyros and gurus alike". :wink:

Arnaldo Zayas
Arnaldo Zayas
577 Points

That's a neat quote, kinda like the devil is in the details no matter who you are.