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

Use Console.WriteLine to print the contents of the firstName variable to the screen. 2 hours still cant solve it

ive been sitting front on my pc 2 hours on that challenge tast in c# basics the last task :Use Console.WriteLine to print the contents of the firstName variable to the screen. i still cant solve it i tried everything....

string firstName = Console.ReadLine(); /This is to get the input of the console into firstName variable. */ Console.WriteLine("FirstName: {0}", firstName); /*To write it back to console/

3 Answers

Steven Parker
Steven Parker
231,248 Points

Though you didn't post your code, you obviously passed task 1 already. Task 2 also involves a function call, but instead of assigning the output to a variable, you will pass the variable to the function as a parameter.

Remember that parameters go inside the parentheses "()" that follow the function name.

Be sure to post your code if you need any additional assistance.

thanks alot man and sorry for late reply you reminded me little things that i didnt pay attention to...

David Good
David Good
12,348 Points

The WriteLine() function accepts a String variable as a parameter. You don't need to type WriteLine(string firstName), only WriteLine(firstName)

Im having the same issue.

C#

string firstName; Console.ReadLine(); Console.WriteLine(string firstName);

and it still says "Did you forget to pass firstName to WriteLine as a parameter?" please help me