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

Hector Montanez
Hector Montanez
141 Points

String bookTitle = System.Console.Read.Line(); is the answer for C# basics question 2?

the system say that is wrong, Why..

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

1 Answer

andren
andren
28,558 Points

There is an error in your code, in C# string variables are declared with the keyword "string" not "String", correct capitalization is important when programming.

It's also worth noting that when completing challenges that has multiple tasks you need to keep the code from all of the tasks around while you complete the challenge. In this instance since the first task asks you to use "System.Console.Write()" to write a message to the user, the code to do that has to be kept around when you solve the second task. If you erase the code from the first task you won't be able to complete the challenge.

So to solve this challenge you need to enter this code:

System.Console.Write("Enter a book title: ");
string bookTitle = System.Console.ReadLine();