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 Variable Scope

Challenge Task 1 of 1 Fix the code so that it compiles, but don't change the intent of the code.

I am having trouble with this Challenge Task 1 of 1.

Fix the code so that it compiles, but don't change the intent of the code.

My code is incorrect and I'm not sure what I need to do next to fix it?

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {            
            input = Console.ReadLine()

            if (input == "quit")
            {
                Console.WriteLine("Goodbye.");
            }
            else
            {
                Console.WriteLine("You entered " + input + ".");
            }


        }
    }
}
Dennis Smith
Dennis Smith
1,036 Points

Looks like you need to set a variable type for input. Try using var.

1 Answer

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello Mark,

You're missing the type for variable "input" as well as an ending semicolon after the ReadLine method. Once you make these changes you should be able to pass the challenge.

I hope this helps.