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 trialCody Perryman
4,209 PointsI don't understand why my code for the second part of the coding challenge is not working.
I don't understand why my code for the second part of the coding challenge is not working. When I run my code in Xcode, it works... My code is pasted below.
struct Person { let firstName: String let lastName: String
func getFullName() -> (String) {
return "\(firstName) \(lastName)"
}
}
let fullName = Person(firstName: "Billy", lastName: "Bob")
struct Person {
let firstName: String
let lastName: String
}
1 Answer
Christian Heine
17,520 PointsHm. I think I posted this wrongly. Please check the comment above for the answer :)
Christian Heine
17,520 PointsChristian Heine
17,520 PointsHi Cody,
It seems to be working.
Maybe some issue in the Treehouse parser.
I assume it has to do with the brackets around String when returning the value. Normally you would use the brackets when working with Tuples.
So instead of writing
func getFullName() -> (String) {
use
func getFullName() -> String {
Here's the whole code from your example:
Here's the official reference for the function return syntax