Currying: Difference between revisions

m
Line 572:
println(add2) // (Function)
println(add2(x:7)) // 9</lang>
There is a bug isin Swift (as of 1.1) which forces the second parameter to always be labeled. To avoid it, you can return a closure (or nested function):
<lang Swift>func addN(n:Int)->Int->Int { return {$0 + n} }
 
Anonymous user