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 trialB A
1,860 PointsProblem
Can you pls check my code out? I dont understand the problem here.
struct Person {
let firstName: String
let lastName: String
func getFullName(firstName: String , lastName: String) -> String
{
let name: String = "\(firstName) , \(lastName)"
return name
}
}
3 Answers
Fiodar Shkolnikau
3,426 PointsYou are not supposed to put anything into the parameter. Only return the full name by using string interpolation. A return type. Then make a constant called aPerson of instance Person. There you give the Person any first and second name you want. After you can make another constant called fullName (for example) and assign it to aPerson of the getFullName function.
struct Person { let firstName: String let lastName: String
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
}
let aPerson = Person(firstName: "Ewan", lastName: "Rennie")
let fullName = aPerson.getFullName()
MODERATOR EDIT: Changed the response from Comment section to Answers.
B A
1,860 PointsThank you very much.
Fiodar Shkolnikau
3,426 PointsNo problem, happy coding!