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 trialYusef Andrews
3,982 PointsWhen 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
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
54,972 PointsThere is a note in the instructions:
(Note that the output is surrounded by quotes.)
You'll need to update your return statement:
return ('"' + a + '"');
KRIS NIKOLAISEN
54,972 PointsYes. A hint. That's what it was trying to do
KRIS NIKOLAISEN
54,972 PointsIf 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.
Yusef Andrews
3,982 PointsSo in other words, its was trying to give me a hint correct? I understand now, although I was expecting a compiler error to research.
Yusef Andrews
3,982 PointsYusef Andrews
3,982 PointsThanks 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.