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 trialAustin Stewart
2,662 PointsI cant figure out what im doing wrong the error i get is We called Quote("Patrick, I don't think wumbo is a real word.
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
using System;
class Program
{
static string Quote(string phrase)
{
return phrase;
}
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."));
}
}
2 Answers
Jennifer Nordell
Treehouse TeacherHi there, Austin Stewart ! I received your request for assistance. It looks like you're doing fairly well, but there seems to be a misunderstanding of what they're asking They want you to return the string together with the actual quotation marks a part of the string that is returned. They actually want the quotation marks printed to the console.
Try this in your return
line:
return "\"" + phrase + "\"";
or
return '"' + phrase + '"';
In the first example I used the \
to escape the quotation marks to say they are not the beginning nor ending of a string, rather they are the literal quotation marks. In the second example, I used the single quotes to encapsulate the quotation marks and then concatenated the phrase inside them. The result of this is that quotation marks will be added to either side of the string as part of the string or the literal character for quotation marks and be printed to the screen.
Hope this helps and clears up what they're after!
Austin Stewart
2,662 Pointswow thanks i knew it was something simple i just didn't think to use in as a concatenation.