C# C# Basics Strings Escape Sequences

Steven font
PRO
Steven font
Pro Student 927 Points

Does this Challenge task need to be updated? When i check my work the reply shows a completely unrelated quote.

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 w

Program.cs
using System;

class Program
{
    static string Quote (string phrase)
    {
        return phrase;
    }
    // YOUR CODE HERE: Define a Quote method!

    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.\""));
    }

}

1 Answer

When you return the string represented by the argument phrase, you need to return it with the double quotes surrounding it. So your method needs to do something like return "\"" + phrase + "\"". But I may not have the syntax exactly right, as I haven't done much with C# in recent months. The point being, however, you need to do something to get those double quotes into the picture.

Steven font
Steven font
Pro Student 927 Points

I understand what the task is asking but the string returned when clicking on the 'check work' button is a completely different string than what we see in the exercise. The string used in the exercise is 'When you learn, teach. When you get, give.'

When i click on the check work button I receive an error message that refers to a completely different string. 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...