Declare a closure with arguments


I want to declare a closure that takes one or more parameters and/or returns some result.


// Declare a closure with 2 integer arguments
// returning an Integer
let multiply = {(x:Int,y:Int)->Int in
    return x*y

// Call it
let result = multiply(2,5)

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)