SHARE
TWEET

Untitled

a guest Jul 16th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let f: () -> Void = { print("hi") }
  2. f()
  3. //f(()) // ERROR
  4.  
  5. // let f2: (()) -> Void = { print("hi") } // ERROR
  6. let f2: (()) -> Void = { _ in print("hi2") }
  7. //f2() // ERROR
  8. f2(())
  9. f2((()))
  10. f2(((())))
  11.  
  12. let f3: ((())) -> Void = { _ in print("hi3") }
  13. //f3() // ERROR
  14. f3(())
  15. f3((()))
  16. f3(((())))
  17.  
  18. //let g: (Void) -> Void = { print("void") } // ERROR
  19. let g: (Void) -> Void = { _ in print("void") } // WARNING: When calling this function in Swift 4 or later, you must pass a '()' tuple; did you mean for the input type to be '()'?
  20. //g() // ERROR
  21. g(())
  22. g((()))
  23. g(((())))
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