Jean Le Moignan
Jean Le Moignan

Reputation: 22236

It compiles in Swift... but what is it?

I mistakenly typed something like this in Swift:

var a = [Int, Int, Int]()

and it compiles... but I have no clue what this can represent...

Any ideas? Can someone explain the semantic meaning of it?

Thanks, happy coding to all,

Upvotes: 3

Views: 88

Answers (1)

Logan
Logan

Reputation: 53112

It's an array of tuples of type (Int, Int, Int) Consider the following:

var a = [Int, Int, Int]()
a.append(12, 1134, 124)
var first = a.first!
first.0 //= 12
first.1 //= 1134
first.2 //= 124

Upvotes: 5

Related Questions