RosettaCodeData/Task/Higher-order-functions/Swift/higher-order-functions-2.swift

3 lines
102 B
Swift
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
func func3<T>(f: (Int,Int)->T) -> T { return f(1, 2) }
println(func3 {(x, y) in x + y}) // prints "3"