Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jeremy Lyles
3,886 PointsDoes the compiler for this challenge work?
When I copy and pasted the code that I initially wrote in the browser into my Swift playground, the results read that the compiler does not work despite the code working in my playground. Is there something wrong with the browser compiler, or am I missing something?
struct Person {
let firstName: String = "Chris P."
let lastName: String = "Bacon"
func fullName() -> String{
return "\(firstName) \(lastName)"
}
}
let aPerson = Person()
let myFullName = aPerson.fullName()
1 Answer

Magnus Hållberg
17,232 PointsYes it works. Its just that you are supposed to use the struct "built in" initializer, not to give the properties them selves values. In this case the aPerson constant should look like this: let aPerson = Person(firstName: "Chris P.", lastName: "Bacon"). Good luck
Jeremy Lyles
3,886 PointsJeremy Lyles
3,886 PointsThank you for the answer! this actually helped a few things click in my head about the core differences between structs and classes in Swift.