A

Admin • 833.24K Points
Coach

Q. Which of the following is a correct way to define a closure in Swift?

  • (A) { (x: Int) -> Int in return x * x }
  • (B) function(x) { return x * x }
  • (C) [x: Int] => x * x
  • (D) (x) -> x * x
  • Correct Answer - Option(A)
  • Views: 35
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin

This is the correct closure syntax in Swift.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.