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 Hunt
329 Pointshow do you return something
using System;
class Program
{
static void Multiply(double firstParam, double secondParam)
{
Console.(firstParam * secondParam);
}
static int Main(string[] args)
{
Multiply(2.5, 2);
Multiply(6, 7);
}
}
2 Answers
Travis Alstrand
Treehouse Project ReviewerHey Brandon Hunt !
As stated in the challenge, we'll want to return the results of the math in our Multiply
method instead of logging it to the console. So we'll want to use the return
keyword instead of Console.WriteLine()
.
Also, since this Multiply
method will now be returning a value, we need to change void
in the method to the data type we want to return, which is also stated in the challenge above.
Then you'll need to do similar changes for your second Main
method. Just be sure to read the challenge tasks carefully I hope this helps you out!
Steven Parker
231,275 PointsThere's a statement keyword just for this purpose, named return.
You might want to review the lesson on Method Return Values.