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

How do I pass `firstName` to `WriteLine` as a parameter?

How do i pass the string 'firstName' to 'System.Console.WriteLine();' as a parameter... watch it be obvious

2 Answers

Steven Parker
Steven Parker
229,788 Points

The parameters passed to a function are placed inside the parentheses that follow the function name. So to pass a parameter named firstName to the "Console.WriteLine()* function, it would look like this:

Console.WriteLine(firstName);
Christian 123
Christian 123
6,899 Points

Yea i got confused if he was trying to print out "firstName" or trying to print the variable but he had camelCase on it. guess im just stupid lol

Thank you for your help...that makes sense now

Christian 123
Christian 123
6,899 Points

Uh i don't understand exactly what you are saying if you want to print "firstName" to the console just do

System.Console.WriteLine("firstName");

But it does look like how you wrote first name is a variable so to pass a variable just do the same thing with out any double quotation marks. :) Hope this helped if it didn't msg me agian

Thanks for your help