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

what on earth am I doing wrong? Bug on C# Basics Console I/O?

First question: declare your variable for bookTitle so I enter string bookTitle; and get a big green tick Next question: Assign bookTitle the title of your favourite book so I enter bookTitle = "lordOfTheFlies"; no joy so I try string bookTitle = "lordOfTheFlies"; no joy.... I'm a wee bit stuck any help would be much appreciated.

Thanks for trying to help guys - I have sent a message to support so hopefully they will be able to resolve it. Highly frustrating for a newbie like me but I guess at least it helped me to be super critical and analyse my code for any mistakes

These things happen pretty infrequntly, thankfully! Support should be able to help you get moving and, yes, you'll never forget how to declare a string properly!! :-)

5 Answers

For those who have a similar problem: I managed to make it work by answering the first 2 questions on the same line.

Common sense tells me that this suppose to work and this is how you suppose to write your code:

String bookTitle = "lordOfTheFlies";

Yeah thats what I wrote and it says I'm wrong...? Is it a bug maybe?

I got this to work with all the code on one line and a lowercase string keyword.

string bookTitle = "The Catcher in the Rye";

Steve.

Thanks I tried that - still not working it comes up with this message: Bummer! Did you set 'bookTitle' using the equals sign and a string value?

There must be intermittent issues with the site, then. It is working fine here. Maybe shout support.

Ran your code in challenges( all 4), no problems.

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

I was getting the error when I had:

string bookTitle; string bookTitle = "lordOfTheFlies";

Once I removed string bookTitle;

My answer was found to be correct.