I have an array:
var myArray:[(Int,Int)] = []
But when I add value to it:
myArray.append((1,2))
The compiler displays an error warning. What is wrong with my syntax?
var myArray:(Int,Int)[] = [] myArray.append( 1,1 ); print("myArray =\(myArray)");
The above code works fine
Your tuple does not need a second set of parentheses around it. This works great:
myArray.append( 1,1 );
Source: https://habr.com/ru/post/972431/More articles:Odd syntax in API "String :: concat" - javaCalling the constructor of a potential child from the database in C ++ - c ++Inheritance of extension methods - inheritanceComposer auto-update - composer-phpHow to model an abstract class and call its constructor? - oopPromoting bcrypt-nodejs using Bluebird - javascriptHow to get to function definition in emacs when using mucus? - emacs"Package file is invalid", solution by the developer (Android) - androidWhy are two seemingly identical types of dynamic arrays considered incompatible with assignment? - delphiFirebird 2.5.2 modifies the blob subtype - firebirdAll Articles