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 Strings Strings

C# Basics Quiz Question on Escape Characters and Strings

I am absolutely stumped on this quiz question and would like to find out the ideal solution they are looking for. Here is the question:

Please fill in the correct answer in each blank provided below. Fill in the blanks to complete this code so it will compile and print "Hello, Treehouse!" out to the terminal.

using System;

class Program {

static void Main(string[] args)
{
    var name = "Treehouse";
    Console.WriteLine( __"Hello, __ name __ !";
}

}

My response:

using System;

class Program {

static void Main(string[] args)
{
    var name = "Treehouse";
    Console.WriteLine($"\ "Hello, { name }\" !";
}

} When I run this in a workspace, the first blank response gives me the correct result but the quiz states it's wrong as well as the last blank response. I am completely stumped on the last one since I can't figure how to get the very last quotation mark to print with name = "Treehouse" like they want it.

I appreciate the help!

2 Answers

There is an example in this video @2:02 that shows

string name = "Jay"
Console.WriteLine($"Hello {name}!");

This is what the quiz is looking for. I don't think you need to print the quotes.

You're right Kris, for some reason I was under the impression the answer had to be related to using escape characters since that was the video I watched previous to the quiz. I was definitely making it harder than it should have been. Thanks!