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 trialThadeus Gordon
550 PointsConsole 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.
System.Console.Write("Enter a book title: ");
System.Console.Readline();
string bookTitle = "Neuromancer";
1 Answer
Steven Parker
231,248 PointsIt 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.
Thadeus Gordon
550 PointsThadeus Gordon
550 PointsSo, 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
231,248 PointsSteven Parker
231,248 PointsFor 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.
Thadeus Gordon
550 PointsThadeus Gordon
550 PointsI'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
231,248 PointsSteven Parker
231,248 PointsLike 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();