Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  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(((())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement