C# C# Basics Strings Combining Strings

Sebastian Manczak
Sebastian Manczak
3,551 Points

Basic concatenation

I can't move forward. Could I please get more hints? This is what I have come up with so far:

Program.cs
using System;

class Program
{

    // YOUR CODE HERE: Define an Eat method!
    static string Eat(string s1 foodOne, string s2 foodTwo)
    {
      string s1 = "I think";
      string s2 = "are tasty";
      return;

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

}

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 51,734 Points

Some hints:

  • For your parameters use s1 or foodOne but not both
  • You can complete the task with just a return statement
  • You concatenate with the + operator
  • A concatenated string with parameter s1 looks like this: "I think " + s1 + " can do this!"
  • You are missing a closing bracket on your Eat method
Sebastian Manczak
Sebastian Manczak
3,551 Points

Thank you. I think I am getting closer however I am missing something..

Eric McKibbin
Eric McKibbin
Treehouse Moderator 11,450 Points

What does your code look like now Sebastian?

Edit: Ah, I see you have posted again here.