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 trialAramik YOUSEFZADEH
Courses Plus Student 895 PointsI Get code error
I get an error saying : add fullName() method in the structure definition .
struct Person {
let firstName: String
let lastName: String
func fullName (firstN : String , lastN : String) {
var result : String = (firstN + " " + lastN)
return result
}
}
2 Answers
Bill Merickel
11,420 PointsPerhaps it is because you have a space between your method name declaration and the opening parenthesis.
István Lőrincz
2,185 PointsHello, You did almost everything well, expect one thing. You forgot to define a return type to your function, and at defaulet it is Void. You have to do just one thing, add a String return type to your dictionary with the -> operator. It would look like that: func fullName (firstN : String , lastN : String) -> String { }
Keep it up :) Istvan