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) Console I/O Variables

how do i declare a string variable

how do i declare a string variable

CodeChallenge.cs
class program
{
static void Main()
    {
        System.Console.Readline();

        string bookTitle:
    }
}

i have trying to declare a string variable and im stuck. can someone help

1 Answer

andren
andren
28,558 Points

For the basic challenges they don't want you to include any boilerplate code like creating a class and the like, that is done for you automatically.

The only code you need to type is the exact thing the challenge asks for. So for this task the code for declaring the bookTitle variable is the only line of code you need. Like this:

string bookTitle;

The above code is the only line of code needed to complete the first task of this challenge.

Seth Kroger
Seth Kroger
56,413 Points

I'd also point out that she ended her line with with the incorrect punctuation, a colon instead of a semi-colon.