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

Define an eat method

I dont get what this is asking me to do. Why wouldnt you just CWL(i think blueberries and apples are tasty!"?

Program.cs
using System;

class Program
{
    static string Eat(string foodOne, string foodTwo)
    {
       Console.WriteLine("I think apple and blueberries are tasty!"
    }

    // YOUR CODE HERE: Define an Eat method!

    static void Main(string[] args)
    {


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

}

3 Answers

Henry Blandon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Henry Blandon
Full Stack JavaScript Techdegree Graduate 21,521 Points

something is wrong with the workplace, the code below returns: We called Eat("eggs", "falafel"), but we got a return value of "I think eggs and falafel are tasty". We were expecting "I think eggs and falafel are tasty!".

I ran the code in visual studio and works fine I get the expected results.

static string Eat(string foodOne, string foodTwo) {

        return $"I think {foodOne} and {foodTwo} are tasty";
}

static void Main(string[] args)
{
    Console.WriteLine(Eat("apples", "blueberries"));
    Console.WriteLine(Eat("carrots", "daikon"));
}

The challenge wants you to use the parameters to handle different inputs and demonstrate what you learned about concatenation and interpolation. For example when you pass in "carrots" and "daikon" the phrase should be "I think carrots and daikon are tasty!"

Also you wouldn't use CWL because you are being asked to return the string.

Henry,

Not sure how you received a down vote so quick (under 5 minutes?)

You are missing an exclamation point after tasty. You can see it in the message you provided.