Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. func closure(_ f1: () -> Void) -> (() -> Void) -> Void {
  2.  
  3. return { f2 in f1(); f2() }
  4. }
  5.  
  6. // Store and call
  7. let f2 = closure { print("A") }
  8. f2 { print("B") }
  9.  
  10. // Trailing Closure + Parameter
  11. closure { print("C") } ({ print("D") })
  12.  
  13. // Parameter + Parameter
  14. closure({ print("C") })({ print("D") })
  15.  
  16. // Trailing Closure + Trailing Closure
  17. // NG: extra argument in call
  18. //closure { print("C") } { print("D") }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement