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

followed instructions on video, cant still get thisI

followed instructions on video, cant still get this

CodeChallenge.cs
string entry = System.Console.ReadLine();

System.Console.WriteLine(firstName)

string firstName = System.Console.WriteLine(firstName); + entry + "rocks " = "Jeremy";
Daniel Hildreth
Daniel Hildreth
16,170 Points

Steven and James are right. You simply were trying to take the long way about it. All you need to do is assign the firstName variable to the ReadLine method, and then call it when you concatenate the WriteLine method.

string firstName = Console.ReadLine();

Console.WriteLine(firstName + " rocks!");

Excellent! that's cool, Thanks

2 Answers

James Matthews
James Matthews
21,610 Points

Hi Joe,

Close! You simply need to initialize the firstName variable to the string, and you only need to use the concatenate operator (+) to pass this challenge.

string firstName = Console.ReadLine();

Console.WriteLine(firstName + " rocks!");

Hope this helps!

Thanks so much James, I had to sleep over it, wow! I appreciate.

Steven Parker
Steven Parker
231,210 Points

:point_right: There are a few issues in this code.

  • the first line should be assigning the variable firstName (not entry)
  • the second line is missing a semicolon (;) at the end
  • for task 3, you'll concatenate the word " rocks!" to firstName inside the call to WriteLine
  • the third line has a syntax error but is not needed for the challenge

Hi Steven Thanks!