Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Ali Dabbir Khan
Ali Dabbir Khan
1,076 Points

I don't understand the error

Explain the mistake please

CodeChallenge.cs
using System;

Console.WriteLine("What is your first name?");
Console.ReadLine();

string firstName = Console.ReadLine();

1 Answer

Antonio De Rose
Antonio De Rose
20,882 Points
// few mistakes
// 1) no need of using System, in the workspace, unless it is being asked for
// 2) your order is wrong, and does not make any sense

//  string firstName = Console.ReadLine(), this is correct, and it would have to come right at the top
// then, you will have to use Writeline, to print the name which is already inside the firstName variable.
Ali Dabbir Khan
Ali Dabbir Khan
1,076 Points

I just started today, do you mind showing me how this is fixed? Thank you

I tried putting the string on top but I don't get the last comment

Ali Dabbir Khan
Ali Dabbir Khan
1,076 Points

Oh it worked, thanks a lot :)