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 trialDonevin Smith
395 PointsHow 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
231,248 PointsThe 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
6,899 PointsUh 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
Donevin Smith
395 PointsThanks for your help
Christian 123
6,899 PointsChristian 123
6,899 PointsYea 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
Donevin Smith
395 PointsDonevin Smith
395 PointsThank you for your help...that makes sense now