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 trialAYMAN ABOUZED
1,924 Pointsstring bookTitle = System.Console.ReadLine(); string bookTitle ="Favoritebook"; System.Console.Write("Enter a book tit
string bookTitle = System.Console.ReadLine(); string bookTitle ="Favoritebook"; System.Console.Write("Enter a book title: "); string bookTitle = System.Console.ReadLine();
string bookTitle = System.Console.ReadLine();
string bookTitle ="Favoritebook";
System.Console.Write("Enter a book title: ");
string bookTitle = System.Console.ReadLine();
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! Your code seems to be a bit out of order, but I'm guessing that's because you've fiddled with it a good bit. It seems you got the first two/three steps correct, but in the last step you're actually redeclaring your variable (as denoted by the string
in front). This is not needed. Take a look at my solution:
string bookTitle = "Whatever";
System.Console.Write("Enter a book title: ");
bookTitle = System.Console.ReadLine();
The last step will read in the string entered by the user from the console and assign it back into bookTitle
. Hope this helps!
jimmywidlund
1,701 PointsHaha ok sorry, i just jumped right in! I hope iยดll get to the challenge soon.
jimmywidlund
1,701 Pointsjimmywidlund
1,701 PointsHi Jennifer i have a question about your answer. Why declare the variable on the first row? Iยดm a beginner but as i see it one could omit the first step and do:
System.Console.Write("Enter a book title: ");
string bookTitle = System.Console.ReadLine();
Or am i missing something?
I guess if one wants to use bookTitle multiple times?
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherJimmy Widlund you absolutely can do that! But take a look at the challenge I did it this way because it more accurately reflects the order of the steps in the challenge. That's all!