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# Basics (Retired) Perfect Final

Unexpected symbol '{'

between lines 14 and 12 it tells me that there is an unexpected symbol '{'

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter the number of times to print \"Yay!\": ");

            string entry = Console.ReadLine();

            int times = int.Parse(entry);

            While(entry > 0)
            {
                Console.WriteLine("Yay!");
            }





        }
    }
}

1 Answer

Denny Scott
Denny Scott
16,092 Points

Your while loop has a capital w. while is a keyword in c#, that expects curly braces to follow. On the other hand, While isn't understood by the interpreter, so the interpreter doesn't understand why there are curly braces following a random word. You should find by switching to a lower case w you will get by this error case. Hope that helps you :).

Thank you very much for clearing things up, and for responding so quickly