Reputation: 423
I have the array:
var myArray:[(Int,Int)] = []
But when I add value to it by:
myArray.append((1,2))
The compiler show mistake warning. What is wrong with my syntax?
Upvotes: 6
Views: 933
Reputation: 3401
var myArray:(Int,Int)[] = []
myArray.append( 1,1 );
print("myArray =\(myArray)");
The above code works fine
Upvotes: 4
Reputation: 343
Your tuple doesn't need a second set of parentheses around it. This works fine:
myArray.append( 1,1 );
Upvotes: 4