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

Use the System.Console.ReadLine method to read the user’s response from the console and store it in a variable named boo

Use the System.Console.ReadLine method to read the user’s response from the console and store it in a variable named bookTitle.

CodeChallenge.cs
System.Console.ReadLine();
System.Console.Write("bookTitle.");
Michael Bateman
Michael Bateman
2,684 Points

You need to declare the variable instead of just printing it. The string bookTitle part declares it, and the equals sign fills it with user input.

string bookTitle = System.Console.ReadLine();

Daniel Breen
Daniel Breen
14,943 Points

+1 Michael Bateman.

Then you also need to Write the variable, not the string.

edit: In addtion to Michael's comment, the Write should come first and the text should be as described in Step 1.

// Write a question for the user to answer
// Read the user's response and store it in bookTitle
Steven Parker
Steven Parker
229,732 Points

:warning: No variables are written for this challenge.

1 Answer

Steven Parker
Steven Parker
229,732 Points

There are two tasks in this challenge.

The first one is to write out a string to ask the user for input. I'm guessing you got that right and moved on to task 2, but it looks like you erased that line from your code. In multi-task challenges, it is important to keep each task you complete and add to it for the next task.

Then for task 2, you add another line to bring in the user's input and store it into a variable. Michael already showed you that line of the solution. So just be sure both lines are there when you submit the task 2 answer.