Well i'm completely new to C# so my code is very simple but i want someone to look at this very small piece of code and tell me what's wrong with it because when i am finished writing it, it gets an error at all my semicolons.

{
    class Program
    {
        static void Main(string[] args)
        {

            int Age = 18;

            switch (Age)
            {
                case 18;

                    Console.WriteLine("Allowed in!");
                    break;

                case 17;
                    
                    Console.WriteLine("Not allowed in!");
                    break;

                case 19;

                    Console.WriteLine("Your too old!");
                    break;
            
            }
        }
    }
}

This

case 17;

should be

case 17://note its a colon

Just noticed that, thanks alot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.