Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- @inline(never)
- func makeFunc(_ x: Int) -> () -> Void {
- if arc4random() & 1 == 0 {
- return { print(x + 1) }
- } else {
- return { print(x - 1) }
- }
- }
- func test() {
- let funcs = [makeFunc(1), makeFunc(2), makeFunc(3), makeFunc(4), makeFunc(5), makeFunc(6)]
- print(funcs)
- }
- test()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement