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

Compiler errors, WHY!?!?!?!

Frog.cs(10,12): error CS1525: Unexpected symbol public' Frog.cs(10,30): error CS1525: Unexpected symbol(' Frog.cs(17,0): error CS1525: Unexpected symbol `}' Compilation failed: 3 error(s), 0 warnings

These are my errors, and I don't understand why, everything looks similar to how he demonstrated it in the video

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

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;

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

2 Answers

Steven Parker
Steven Parker
229,582 Points

:point_right: It looks like you placed your method inside the constructor method.

Just move it to right after the constructor and you should be in good shape!

Oh I put it inside the Frog method, not the Frog class, got it, Thank you!