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#

Can anyone help me figure out this code challenge in C# basics?

I'm stuck on this code challenge and was wondering if anyone can help. Here's the set up from the first question: string firstName; console.ReadLine(); On this question it asks: "Use console.WriteLine to print the contents of the firstName variable to the screen." I don't understand the question since I didn't assign a value to the firstName variable. I did try messing with Console.WriteLine but I keep getting an error saying bummer did you forget to pass the contents of firstName to Console.WriteLine. I watched the video a couple of times and didn't see the answer. Help please and thank you.

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Kevin;

It has been a while since I have gone through the C# Basics course and without a link to the specific code challenge you are working on, this will likely be from memory.

The first step of that code challenge is to declare the firstName variable and then initialize it, correct? Based on the contents of your question above, I think this is what your answer was as follows for Step 1:

string firstName; 
Console.ReadLine(); 

I don't see where you initialized the firstName variable. I will follow up on that to see if that was intended to pass.

At any rate, you will need to initialize firstName to proceed in Step 2.

Post back with further questions and happy coding,
Ken

Jeremy McLain
STAFF
Jeremy McLain
Treehouse Guest Teacher

In order to simplify this code challenge, I split it up into two smaller code challenges. You can do them here:

Variables

Console I/O