Last active
May 23, 2016 16:52
-
-
Save oleksii-demedetskyi/aedb73c84410d05fdc079563642f1fcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Cocoa | |
var str = "Hello, playground" | |
struct Test { | |
var value: Int = 0 | |
mutating func incrementer() -> () -> () { | |
return { | |
self.value += 1 | |
print(self) | |
} | |
} | |
} | |
var test = Test() | |
let increment = test.incrementer() | |
increment() // Test(value: 1) | |
increment() // Test(value: 2) | |
increment() // Test(value: 3) | |
increment() // Test(value: 4) | |
print(test) // Test(value: 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment