Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics (Retired) Console I/O Console I/O

xufan liu
xufan liu
1,121 Points

how can i read the user’s response from the console and store it in a variable named bookTitle in this situation?

I don`t know how to fix it.

CodeChallenge.cs
System.Console.Write (bookTitle);
string bookTitle ;
System.Console.ReadLine();

1 Answer

In this situation you want to assign the user's entry to the variable bookTitle. At the moment you declared an empty string called bookTitle and then asked the user for input, the two are not related right now because you seperated them with a semicolon ( ; ) .

The following code declares the string bookTitle to store/contain the user's input.

string bookTitle = System.Console.ReadLine();