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

Console I/O help

I don't really know what I'm doing wrong. Its wanting me to do something with the response or result, but I don't know how.

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

System.Console.Readline();

string bookTitle = "Neuromancer";

1 Answer

Steven Parker
Steven Parker
221,297 Points

It wants you to put the response coming in into your variable.

Calling ReadLine by itself doesn't really do anything. You need do something with the result, like assign it to a variable. Then you created the variable, but assigned it to a static string instead of the incoming result.

But if you move that second line down to replace that static string, you should have it.

So, you mean to put the string inside the parenthesis so the computer associates it with the code. I don't know, I found the Input/Output concept somewhat confusing.

Steven Parker
Steven Parker
221,297 Points

For task 2, you'll assign your variable (the last line up to the "="); but instead of a fixed string, you will assign it using what you currently have on the second line.

Don't worry about the I/O, just think of it as calling a method and assigning the result to a variable.

I'm still really confused, I'm really sorry, but could you explain an example I/O process like this one this one, but in a series of steps. I think I might be able to understand if the whole I/O process is laid out tangibly in front of me.

Steven Parker
Steven Parker
221,297 Points

Like I said, the I/O aspect isn't important here .. it's simple (one step) assignment from a method call:

string bookTitle = System.Console.Readline();