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 trial
ayman abdallah
787 Pointsdo not get parameters or tuples?
func greeting(#person: String) -> String { let language = "English" let greeting = "Hello (person)"
return greeting
}
please help because i do not under stand this
Pierre Smith
11,842 Pointswhat you sent was just a function that takes a string and returns a string. The parameters is what's in between the brackets (#person: String), this is the same as (string person) in other languages. the # sign simply states that when the function is called "person" will have to be placed before the function input. like this:
let name = greetings(person: "Pierre") instead of let name = greetings("Pierre")
it's not needed, it's a feature made to help with legibility.
a tuple is pretty much a dictionary but more flexible.
I'm not gonna go through how this is true but if you like clarification visit http://koreyhinton.com/blog/ios/tuples-in-swift.html
Justin VanHaven
2,135 PointsJustin VanHaven
2,135 PointsCan you be more specific about what it is you don't understand?
Tuples are a 'newer' concept for a lot of iOS developers because they didn't really exist in Objective-C. I found this tutorial helpful for further clarifying some of the concepts introduced in this section:
http://www.raywenderlich.com/75289/swift-tutorial-part-3-tuples-protocols-delegates-table-views