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

jack Sandberg
jack Sandberg
1,659 Points

I don't understand what im doing wrong?

I have no ide what im doing wrong and the compiler doesn't help ...

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

3 Answers

it should look like this:

string firstName = Console.ReadLine();
Steven Parker
Steven Parker
231,248 Points

:point_right: On your top line, you have two issues:

  • you can't use a variable (firstName) before it has been declared and assigned.
  • the function Console.ReadLine() doesn't take an argument.

Of course, fixing the second one will also make the first issue go away. :wink:

Just remove the firstName variable out of the Console.ReadLine(); it shouldn't be in there.