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

How do i do this ? On a new line, use the System.Console.Write() method to print "Enter a book title: " to the console.

i am trying to execute the instrucitons given like this :

On a new line, use the System.Console.Write() method to print "Enter a book title: " to the console.

my answer is

System.Console.Write("Enter a book title: ");

string bookTitle = System.Console.ReadLine();

System.Console.Write("Enter a book title:" );

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

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I think the main problem here is that at some point you went back and changed what you'd already written. It should start with a bookTitle variable set to the title of a book. Then we write to the console a prompt for the user to enter their favorite book. But now you're literally writing to the console "bookTitle". On the last step we simply read in the user's favorite book and assign it as the new value to overwrite our favorite book. Here's how the code should look for the last step.

string bookTitle = "My favorite book";
System.Console.Write("Enter a book title: ");
bookTitle = Console.ReadLine();
Andrew Winkler
Andrew Winkler
37,739 Points

You're code is good, but you're not following the directions.

//existing code from previous challenges
string bookTitle = "book title";

//On a new line, use the System.Console.Write() method to print it's contents - "Enter a book title:" 
System.Console.Write("Enter a book title: ");

//I think Jennifer covered the next step as well..
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I did because I assumed that since the ReadLine was in the OP that they'd made it to that step :) But I could be wrong!