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 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();