A

Admin • 828.03K Points
Coach

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

  • (A) func add<T>(a: T, b: T) -> T
  • (B) function add<T>(T a, T b): T
  • (C) generic add(a, b): T
  • (D) func<T> add(a: T, b: T): T
  • Correct Answer - Option(A)
  • Views: 22
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
This is the correct syntax to define a generic function in Swift.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.