Created
December 5, 2015 00:04
-
-
Save kellegous/c93a59b4fb76acd69ffc 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
| class Bucket { | |
| let id : Int | |
| init(id: Int) { | |
| print("\(id) is upon us.") | |
| self.id = id | |
| } | |
| deinit { | |
| print("\(id) has left the building.") | |
| } | |
| func description() -> String { | |
| return "I am \(id)" | |
| } | |
| } | |
| func thereBeBuckets() { | |
| let bb = Bucket(id: 1) | |
| print(bb.description()) | |
| } | |
| func thereBeBucketsLifted() -> (() -> Void) { | |
| let bb = Bucket(id: 2) | |
| func sub() { | |
| let bc = Bucket(id: 3) | |
| print(bc.description()) | |
| print(bb.description()) | |
| } | |
| return sub | |
| } | |
| let ba = Bucket(id: 0) | |
| let fn = thereBeBucketsLifted() | |
| thereBeBuckets() |
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
| 0 is upon us. | |
| 2 is upon us. | |
| 1 is upon us. | |
| I am 1 | |
| 1 has left the building. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment