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 trialMark Nembhard
1,387 PointsHow do you return both the string as well as the parameter value
I get returning a value but not the string as well as the parameter. Seems straightforward but it does not follow from what i have been shown so far
Mark Nembhard
1,387 PointsThanks so much. It makes sense although I think with the return keyword it wasn't explicitly stated that you can perform concatenation on a returned value. I take it you can apply any form of mathematical operation on a returned value then? As in return (x/100*2) ^2?
1 Answer
Steven Parker
231,248 PointsYou can use any kind of expression in a "return" statement. It can involve math, call other functions, or some combination of both.
ovtwvgmbwl
5,440 Pointsovtwvgmbwl
5,440 PointsHi Mark.
You're going to want to concatenate the parameter and the string "Hello" before returning. Here's a possible solution:
In this example, you pass 'name' as an argument, then concatenate (adding strings together) "Hello " and passed-in value. By doing this, you're creating and returning a single string with the value "Hello [name]". Does this make sense?