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 trialJun Yap
948 PointsInstance methods challenge is not clearing despite putting in the method to return full name. What am I missing?
I've created a method within the structure to return the full name. Can't seem to pass the challenge. Can anyone tell me what's wrong with this method? It seems to work fine on the playground.
struct Person {
let firstName: String
let lastName: String
func fullName(firstName: String, lastName: String) -> String {
return "\(firstName) \(lastName)"
}
}
1 Answer
William Li
Courses Plus Student 26,868 PointsHi there, the fullName function should take NO argument.
Declare a method named fullName() that returns a string containing the personβs full name.
struct Person {
let firstName: String
let lastName: String
func fullName() -> String {
return "\(firstName) \(lastName)"
}
}