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 trialJoe Nelson
1,331 PointsNot sure what Im missing here
Im not sure why I keep getting this challenge wrong! No matter what value I put in for 'firstName' or 'lastName' I always get "make sure you are returning the correct string. . ."
Could anyone explain to me what Im missing and what it does so I can understand its importance? Thanks!
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String {
let fullName = (firstName + lastName)
return fullName
}
}
1 Answer
Michael Hulet
47,913 PointsI believe the challenge wants you to put a space in between the names. The fastest way to do this IMO is through String interpolation, like this:
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
}
Joe Nelson
1,331 PointsJoe Nelson
1,331 PointsSee, I tried that but I did it like this:
Is there something wrong with that?
Ill give your response a shot! Thank you!
Michael Hulet
47,913 PointsMichael Hulet
47,913 PointsThe only thing I see wrong in your version is that you forgot the "t" in "
lastName
" in yourgetFullName
function