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

Rishabh Soni
Rishabh Soni
827 Points

use of concatenation operator

use the concatenation operator '+' to append "rocks!" to the end of the contents of the firstName variable and print it to the screen using Console.WriteLine.

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

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

2 Answers

Jerson Otzoy
Jerson Otzoy
1,531 Points

Hello, I think you copied the text from the description and that's why it is failing notice how this

Console.WriteLine(firstName + “ rocks!” );

is not the same as this

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

Notice how these characters are not the same and ", the code was expecting for the second ones.

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
20,985 Points
Console.WriteLine(firstName + "rocks!" );

Dear friend, Use the double quotations in place of the `` this operator.

Enjoy coding