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 trialBrooke McBride
8,501 PointsObject-Oriented Swift 3
What am I missing...or is it done incorrectly?
struct Person {
let firstName: String
let lastName: String
}
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
}
1 Answer
Allen Soberano
13,634 PointsYour func method needs to be contained inside the struct. Currently you have it outside so it's a standalone function. Not a method of person. Copy your func fullName into the closing brackets of the struct.
Also reread the task. I end up doing this a lot. You called your method getFullName. Instructions say to call it something else.
I have not included the actual code to make it work because I feel that having to fix it manually is part of the learning. Hope this helps.