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

Oscar Johansson
Oscar Johansson
130 Points

What's wrong?

help me out

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

3 Answers

Antonio De Rose
Antonio De Rose
20,885 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,349 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
    System.Console.Write(bookTitle);