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 Thomas
2,922 PointsWhy do I keep getting it wrong no matter what I do?
using System;
class Program
{
static string Eat(string "foodOne", string "foodTwo")
{
return Eat("I think {apples} and {blueberries} are tasty!");
]
static void Main(string[] args)
{
Console.WriteLine(Eat("apples", "blueberries"));
Console.WriteLine(Eat("carrots", "daikon"));
}
}
2 Answers
Steven Parker
231,271 PointsThere are multiple issues that must all be resolved together to make it work:
- parameter names must not be enclosed in quotes
- the return value should be just the string (and not in a recursive call to the method)
- a template string must begin with a dollar sign (
$
) - the tokens in the template string must contain the parameter names (like foodOne instead of apples)
- the closing mark for the method should be a brace (
}
) instead of a bracket (]
)
Iman Fakhar Gomi
Full Stack JavaScript Techdegree Student 2,483 PointsGo back and re watch the videos and look at how they create parameters in methods!