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 trialRyan Maneo
4,342 PointsDidn't work
I did it exactly how it asked, and it will not work. It compiled perfectly in Xcode also...
struct Person {
let firstName: String
let lastName: String
func getFullName() -> (String) {
return firstName + " " + lastName
}}
let aPerson = Person(firstName: "Ryan", lastName: "Minnick")
let fullName = aPerson.getFullName()
2 Answers
Nathan Tallack
22,160 PointsGreat work! Very close. No need to put brackets around the return type.
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String { // No brackets around return type.
return firstName + " " + lastName
}}
let aPerson = Person(firstName: "Ryan", lastName: "Minnick")
let fullName = aPerson.getFullName()
No idea why workspace cares about this. While it is not "required" it is not syntatically incorrect. But one thing I have learnt about workspaces is it does not like things that are not required. ;)
Thomas Katalenas
11,033 Pointsis that because of parsing? o _raw_intNS
Nathan Tallack
22,160 PointsNot sure. All I know is workspaces cares about syntatic perfection. ;)