C# C# Basics Strings Escape Sequences

When clicking preview for the code challenge I get a completely different result from what my code should display

I'm trying to pass the quote "When you learn, teach. When you get, give", but when I hit preview it brings up something

Program.cs
using System;

class Program
{

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

}

4 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 51,733 Points

There is a note in the instructions:

(Note that the output is surrounded by quotes.)

You'll need to update your return statement:

return ('"' + a + '"');

Thanks for this, but I was confused because the results wouldn't specify an error. It keep bringing up a totally separate quote saying something like "I don't think wumbo exist", which is nowhere in my code.

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 51,733 Points

If you look closely at it: We called Quote(

"Patrick, I don't think wumbo is a real word."

), but we got a return value of:

'Patrick, I don't think wumbo is a real word.'.

We were expecting

'"Patrick, I don't think wumbo is a real word."'.

you see the double quotes surrounding the expected.

So in other words, its was trying to give me a hint correct? I understand now, although I was expecting a compiler error to research.