C# C# Basics (Retired) Console I/O Formatting Output

Did you forget to pass `firstName` to `WriteLine` as a parameter?

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

On the above piece of code I keep on getting the error mentioned in title. Kindly help!

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

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! In your Console.WriteLine() you have an unnecessary + before the firstName variable which is causing a compiler error. At this point, your code can no longer be compiled. Remember a + sign is used either to add two numbers together or add two strings together, but there is nothing preceding that plus sign.

Also, while this does not affect the challenge at all, you did not include a space before "rocks!". If I put in "Ashish", your code would print out Ashichrocks! instead of Ashish rocks!.

Hope this helps! :sparkles: