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 trialDzmitry Matsiulka
1,075 PointsMy code cannot be compiled but the output doesn't show anything.
It compiles in xCode, however it does nothing in the treehouse editor. Could anyone help me please.
2 Answers
Jaroslaw Adamowicz
11,634 PointsHi there,
it is hard to tell you what went wrong without having your input :)
But let's get you up to speed:
1) First part of challenge you simply need to add method in Person class (before last curly brace). This method can look like this one:
func fullName() -> String {
return firstName + " " + lastName
}
2) Second part of this challenge requires you to create 2 constants. First is aPerson (so you need to use initializer) and then myFullName for which you only need to use aPerson object and call method you did created in 1st part.
So, here is aPerson
let aPerson = Person(firstName: "John", lastName:"Smith")
and here is a myFullName :
let myFullName = aPerson.fullName()
NOTE: you can use another name than "John Smith", that is only for example :D
I hope now it all compiles and you can continue your learning journey!
Cheers! Jarek
Darryl Charleston
5,978 PointsWhereβs your code example?