Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Concatenation code challenge.

I'm stuck on the second question, which is :Create a variable called fullName and assign it a value equal to the concatenation of the firstName variable, a space, the middleName variable, a space, and the lastName variable.

My answer is: $fullName = $firstName . " " . $middleName . " " . $lastName;

The response that I receive is: Bummer! $fullName is set, but it's not the concatenation of $firstName, $middleName, and $lastName with spaces between them.

I do not see what I'm doing wrong. May someone help me out , thanks.

John Breiner
John Breiner
6,918 Points

Ok I'm not entirely sure but you may be missing a space. $fullName = $firstName . " " . $middleName . " " . %lastName;

3 Answers

Rasmus Boserup
Rasmus Boserup
973 Points

Hi,

Not sure what course you are on, but i am guessing you might need some +'es in there :-)

Try: $fullName = $firstName + " " + $middleName + " " + $lastName;

Let me know if that works?

John Breiner
John Breiner
6,918 Points

Ok I'm not entirely sure but you may be missing a space. $fullName = $firstName . " " . $middleName . " " . $lastName; That should work.

$fullName = $firstName ." ". $middleName ." ". $lastName; This worked , but thanks for trying to help guys :) .