let numberList = Array(1...10) // type == Array
let numberList2 = [1,2,3,4,5,6,7,8,9,10] // type == [Int]
The code above assigns the com
From The Swift Programming Language: Collection Types
Array Type Shorthand Syntax
The type of a Swift array is written in full as
Array
, where SomeType is the type of values the array is allowed to store. You can also write the type of an array in shorthand form as[SomeType]
. Although the two forms are functionally identical, - the shorthand form is preferred and is used throughout this guide when referring to the type of an array.
That is, both comments are correct - and both represent the same type.