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 trialBrandon Tsueda
895 PointsConcatenation
Everything I put in my methods body keeps returning an error.
using System;
class Program
{
// YOUR CODE HERE: Define an Eat method!
static string Eat(string firstString, string secondString)
{
return;
}
static void Main(string[] args)
{
string firstString = "I think";
string secondString = "are tasty";
Console.WriteLine(Eat($"{firstString} apples and blueberries {secondString}"));
Console.WriteLine(Eat($"{firstString} carrots and daikon {secondString}"));
}
}
1 Answer
Steven Parker
231,268 PointsPart of the issue is that you should put your code only in your method. Don't make any changes to the "Main" method!
Then, be sure to return the string you build in the method using the arguments that are passed in.
Brandon Tsueda
895 PointsBrandon Tsueda
895 PointsThank you!
Sebastian Manczak
3,551 PointsSebastian Manczak
3,551 PointsAny chance you could please post the final correct answer to the task?
Steven Parker
231,268 PointsSteven Parker
231,268 PointsTreehouse discourages posting of explicit answers, but that would generally not be the best thing to help you learn anyway.
If you're having trouble, start a new question where you can post your code and get some hints to help you solve it yourself.