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

Oscar Johansson
Oscar Johansson
130 Points

What's wrong?

help me out

String bookTitle = System.Console.Write (booktitle: );
System.Console.ReadLine (bookTitle);

3 Answers

Antonio De Rose
Antonio De Rose
20,882 Points
String bookTitle = System.Console.Write (booktitle: ); //you should not be storing Console.Write to a variable, rather an input, which is the readLine
System.Console.ReadLine (bookTitle);//readLine will not need a variable inside a method

//I will help you with the first part of the challenge
System.Console.Write("Enter a book title: "); //1st part
//second part, think of it like, when the above is read in file, it prompts you to give an input,
//and the Console.ReadLine, in the next line, you are going to give, will take what
//ever you typed and save it into the variable, that you give.
Dale Severude
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,324 Points

Do not assign the variable bookTitle in the first line. Instead call System.Console.Write(); and paste in the required text "Enter a book title: ".

Then assign bookTitle var bookTitle to be equal to = System.Console.ReadLine();

Christopher Pritchard
Christopher Pritchard
3,411 Points

Hi Oscar, you simply have a mix up between write and read

Try this:

    //Set the new variable, bookTitle, with a ReadLine, not a Write
    string bookTitle = System.Console.ReadLine();
    //Now you can write it out