0

Closures using number parameters

Edit - it is the $0 > $1 which i dont understand Assuming i have the below code: var numbers = [20, 19, 7, 12] And i create a closure numbers.map({ (number: Int) -> Int in var result = 0 If number % 2 == 1 { result = 0 * number } else is number % 2 == 0 { result = 3 * number } Return result )} Can someone please explain how the number parameters works in the below after sorted Let sortedNumbers = numbers.sorted { $0 > $1 } Print(sortedNumbers)

3rd Jan 2017, 9:40 AM
Paul Bartholomew
1 Odpowiedź
0
I understand the dollar signs now These are taking the default arguments and would go up corresponding to how many arugments there are.
10th Jan 2017, 1:56 PM
Paul Bartholomew