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 Escape Sequences

Arnaldo Zayas
Arnaldo Zayas
577 Points

would this have worked

I know its not returning a string to the method but would this have gotten the same print out?

Program.cs
using System;

class Program
{

    // YOUR CODE HERE: Define a Quote method!
static void Quote(string doubleQ)
{
    Console.WriteLine(doubleQ);
}
    static void Main(string[] args)
    {
        // Quote by Maya Angelou.
Quote("\"When you learn, teach. When you get, give.\"");
        // Quote by Benjamin Franklin.
Quote("\"No gains without pains.\"");
    }

}

2 Answers

Steven Parker
Steven Parker
229,732 Points

This looks like the main program would produce the same output (you can try it yourself in the workspace and see).

But the challenge doesn't rely on just the main program output to evaluate your code. It will call your method directly with a different string and examine the result. So implementing something other than what the instructions ask for is not likely to pass the challenge.

Arnaldo Zayas
Arnaldo Zayas
577 Points

Cool, thanks. I get it, any random string would have to output with double qoutes without having them explicitly be part of the string. The function is whats being graded not the individual output. This eases my mind, being able to see it like that. Assuming I am understaing and not just lost. lol

Steven Parker
Steven Parker
229,732 Points

Arnaldo Zayas — I think you got it! You can mark the question solved by choosing a "best answer".
And happy coding!