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 trial
william fashanu
2,108 Pointscode not working
Given the struct below in the editor, we want to add a method that returns the person’s full name. Declare a method named getFullName() that returns a string containing the person’s full name. Note: Make sure to allow for a space between the first and last name
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
2 Answers
Martin Wildfeuer
Courses Plus Student 11,071 PointsThe closing bracket of the getFullName method is missing.
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
}
william fashanu
2,108 Pointsi read your code thinking it was my original code so i got confused sorry, my bad. i thought you quoted my original code so i thought the brackets where originally there ( still getting the hang of things on this ) thanks for your help both of you :)
Martin Wildfeuer
Courses Plus Student 11,071 PointsNo worries william fashanu , it's easy to miss the little things. However, I'd strongly recommend to not only use the code check here, but Xcode Playgrounds to test your code. That error would have been highlighted right away, not to mention that code completion would have added that bracket automatically. It makes our life so much easier ;)
william fashanu
2,108 Pointswilliam fashanu
2,108 Pointsi'm sorry, what do you mean?
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsMartin Wildfeuer
Courses Plus Student 11,071 PointsMartin Wildfeuer
Courses Plus Student 11,071 PointsThanks Caleb Kleveter, I should have made it a bit more obvious :)