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 trialAJ Vazquez
1,064 PointsI have tried and tried again but my code doesn't seem right, what is going wrong?
To make a method you have to specify the stringent,double,etc. to finish it but the challenge doesn't give me anything to go on. What should I be seeing that I'm not?
struct Person {
let firstName: String
let lastName: String
}
let fullName = Person(firstName: first?Name, lastName: Last?Name)
Kristof Kocsis
15,455 PointsA method is a function within a struct or class. So you have to declare a function inside the struct that returns a string.
1 Answer
Kristof Kocsis
15,455 PointsIn the comment I explained how to do it and now here is the actual code.
struct Person {
let firstName: String
let lastName: String
func fullName() -> String {
return "\(firstName) \(lastName)"
}
}
AJ Vazquez
1,064 PointsThank you so much I have a problem with which makes it hard to think when under stress. the condition is called "Life". But still thank you
AJ Vazquez
1,064 PointsAJ Vazquez
1,064 PointsYeah I just don't know