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

Stuck

string bookTitle = "Tom Sawyer"; System.Console.Write("Enter a book title: "); string entry = System.Console.Readline();

Stuck on the 4th step. No clue what to do.

CodeChallenge.cs
string bookTitle = "Tom Sawyer";
System.Console.Write("Enter a book title: ");
string entry = System.Console.Readline();

5 Answers

Jake Lundberg
Jake Lundberg
13,965 Points

instead of creating a new variable called "entry" like you just did, you need to assign the value from System.Console.Readline() to your existing variable "bookTitle".

bookTitle = System.Console.Readline();

Your code should look like this

string bookTitle = "My fav book";
System.Console.Write("Enter a book title: ");
bookTitle = System.Console.ReadLine();

The mistake that you did is using entry. They told you get whatever the user gives you and store it in the string bookTitle

Yea I don't know how to do that.

Jake Lundberg
Jake Lundberg
13,965 Points
bookTitle = System.Console.Readline();

OOOOOOOOOOh, ok thanks.

Jake Lundberg
Jake Lundberg
13,965 Points

oops, typo - "L" in Readline needs to be capitalized...

bookTitle = System.Console.ReadLine();

Perfect thanks.

If my answer have answered your question and helped you solve the problem, please choose it as Best Answer. Thank you :)