A

Admin • 828.03K Points
Coach

Q. Which of these is a correct way to create a set in Swift?

  • (A) var mySet = Set()
  • (B) var mySet = Set<Int>()
  • (C) var mySet = [Int]()
  • (D) var mySet = Dictionary()
  • Correct Answer - Option(B)
  • Views: 4
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
`Set<Type>()` is the correct way to declare a typed empty set in Swift.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.