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 Formatting Output

Leo Ngai
Leo Ngai
2,184 Points

I need help again. Really feel confused about this..... Thanks a lot!

I need help again. Really feel confused about this..... Thanks a lot!

CodeChallenge.cs
string firstName = Console.ReadLine();
//Console.WriteLine(firstName);
Console.WriteLine(firstName +  rocks!);

3 Answers

andren
andren
28,558 Points

The cause of your issue isn't a problem with your code, or at least not in the usual sense.

If you look closely at the quote marks surrounding the " rocks!" string in your solution you might notice that they look a little odd, the problem is that they are not standard quote marks, but special left-leaning and right-leaning quote marks which are sometimes used when writing to add a bit of extra style to the text.

I assume you copied the string from the task instruction, as the instruction for this task does use those styled quote marks. The problem is that while they don't look that different to the human eye they look like a completely different symbol to a PC, the c# compiler expects strings to start and end with standard quote marks, special ones are not accepted.

So to solve this issue just remove the special quote marks from your code and add normal quotes using the key on your keyboard, like this:

string firstName = Console.ReadLine();
//Console.WriteLine(firstName);
Console.WriteLine(firstName + " rocks!");

Then you'll be able to pass the challenge since the rest of your code is fine.

string firstName = Console.ReadLine();
Console.WriteLine(firstName + " rocks!");

Something was wrong with your quotes. Think it may have been a copy/paste issue.

Leo Ngai
Leo Ngai
2,184 Points

Thanks a lot! It solved my issue.