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

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,885 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 :)