Answers for "syntax of closures"

0

syntax of closures

/*
{ (parameters) -> return type in
body
}
*/

var numbers = [1, 2, 3, 4]

var reversed = numbers.sorted(by: {(a: Int, b: Int) -> Bool in
    return a > b
})
Posted by: Guest on September-05-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language