SHARE
TWEET

Untitled

a guest Oct 29th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Foundation
  2.  
  3. @inline(never)
  4. func makeFunc(_ x: Int) -> () -> Void {
  5.     if arc4random() & 1 == 0 {
  6.         return { print(x + 1) }
  7.     } else {
  8.         return { print(x - 1) }
  9.     }
  10. }
  11.  
  12. func test() {
  13.     let funcs = [makeFunc(1), makeFunc(2), makeFunc(3), makeFunc(4), makeFunc(5), makeFunc(6)]
  14.     print(funcs)
  15. }
  16.  
  17. test()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top