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 trialBrett Hodges
698 PointsCodeChallenge.cs.
What am I doing wrong?
string entry = "firstName";
string firstName = Console.ReadLine();
string entry = "firstName";
String firstName = Console.WriteLine();
it keeps saying I need to reference this to a parameter? challenge 2
2 Answers
Robert Lyon
7,551 PointsHere you have assigned the Console.WriteLine() method to the variable firstName. The exercise wants you to use Console.WriteLine() to print the value stored within firstName to the screen.
string firstName = Console.ReadLine();
Console.WriteLine(firstName);
as you can see in the code above, you assigned the string that the user inputs into the variable first name. Then the that string is printed to the screen within the Console.WriteLine().
Hope this helps
Steven Parker
231,248 PointsThe ReadLine function returns something back, that's what you are using in your assignment.
But the WriteLine function needs you to give something to it. When you pass parameters to a function, they must be inside the parentheses (). And you won't want to assign anything using it.
Also, you have two extra lines that both declare and assign a variable named entry. That's not part of the challenge and you don't need either of them; and since you can only declare a variable once, the second one will cause a compiler error.