Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func makeAddingClosure(var start:Int)->(Int)->(Int) {
- return {
- start+=$0
- return start
- }
- }
- let capturedClosure = makeAddingClosure(10)
- capturedClosure(1)
- capturedClosure(8)
- capturedClosure(15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement