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 trial

C# C# Basics Strings Combining Strings

i can't figure out what to do for the return value or how to call apples and blueberries in the string.

Program.cs
using System;

class Program
{

    static string Eat(string foodOne, string foodTwo)
    {

    }
    static void Main(string[] args)
    {
        Console.WriteLine(Eat("apples", "blueberries"));
        Console.WriteLine(Eat("carrots", "daikon"));
        foodOne += " apples";
        foodTwo += " blueberries";
        Console.WriteLine(Eat("I think " + foodOne + " and " + foodTwo + " are tasty!"));

    }

}

2 Answers

First of all u have been asked to create a method called Eat which u did correctly!. you defined that the Eat method should return a string. All u how to do is to return the sentence they supply in the example with the 2 parameters as the placeholders. You dont need to call anything, they do it for u in the Main method which runs the program.

    static string Eat(string firstString,string anotherString) {
        return "I think " + firstString + " and " + anotherString + " are tasty!";   

    }

so do i need the Console.WriteLine in the Main method still?

Nope, you just being asked to create the method. in the Main() method as u see u have this call:

Console.WriteLine(Eat("apples", "blueberries"));
  Console.WriteLine(Eat("carrots", "daikon"));

the staff already called the Eat method for u and passed 2 arguments into them, that will be passed to the function.

Remember, the eat method it just a function that returns a string, in the Main method the actual program is running.