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 trialayman abdallah
787 Pointsi do not understand the instructions for this
func greeting(person: String) -> String {
let language = "English"
let greeting = "Hello \(person)"
return greeting
}
2 Answers
Chris Shaw
26,676 PointsHi ayman,
See the below link, I made a lengthy reply to another user about tuples and a couple of extras which explain the overall fundamentals of them.
Jason Wayne
11,688 PointsBasically this is a method called greeting. It takes in a parameter called person, which is type String. And it returns a String value.
func greeting --> method called greeting (person:String) --> parameter/argument. name of argument is name, type of argument is String -> String --> return type of the method, which is type String
In the method you have to 2 constants, language and greeting which are both type String. The greeting constant takes in the argument person via the string interpolation.
So, when you call this greeting method, it'll be something like, greeting("Jason"). That would return a string, "Hello Jason".