R

Ravina • 2.56K Points
Extraordinary

Q. Which of the following is a valid way to declare an array in Swift?

  • (A) var arr = Array<Int>()
  • (B) int[] arr = new int[]
  • (C) array arr = []
  • (D) arr = list()
  • Correct Answer - Option(A)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina
In Swift, `Array<Type>()` or `[Type]()` is the correct way to declare an array.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.