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 trialMatthew Tandy
1,259 Pointscombining strings c# basics
I am so stuck on challenge task 1 of 1 combining strings c# basics. I have no idea how to call my strings individually.
using System;
class Program
{
static string Eat(string first, string second)
{
return first + second;
}
static void Main(string[] args)
{
string total = Eat("apples"," and blueberries");
Console.WriteLine($"I think {total} are tasty!");
}
}
1 Answer
Matthew Tandy
1,259 PointsHi Alex, Thanks for your reply. I now get a build error ; excepted (8,50) From what i can see I am not missing a ;
using System;
class Program {
static string Eat(string first, string second)
{ return "I think " + first + " and " + second " + are tasty!"; }
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."));
}
}
Matthew Thomas
2,922 PointsUm, why is there a quote by Maya Angelou and Benjamin Franklin here? Did they really ask for this?
Alex Labins
20,825 PointsAlex Labins
20,825 PointsHello Matthew,
The code you provided does indeed create the desired output to the console, but it is not encapsulated within the Eat() method and the Challenge does not expect that. Try this:
Make sure to restart the challenge and leave the Main() method as it is when the challenge loads.