I've started to learn what does tuple mean and I faced with the question what's difference between Array and Tuples. So, I'm just schoolboy who want to learn Swift and I still don't know a lot of things
Tuples have a slight performance improvement to lists and can be used as indices to dictionaries. Arrays only store values of similar data types and are better at processing many values quickly.
Tuples A Tuple represents a collection of objects that are ordered and immutable (cannot be modified). Tuples allow duplicate members and are indexed.
The Tuple type represents a JavaScript array where you can define the data type of each element in the array. a tuple is a special type of array that stores multiple fields belonging to the different data types into the same collection. It is similar to the structures in the c programming language.
The structure of the tuple needs to stay the same (a string followed by a number), whereas the array can have any combination of the two types specified (this can be extended to as many types as is required).
Tuple A tuple is a grouping of unnamed, ordered values. Each value in a tuple does not need to be the same type.
Array An array is mutable collection. They are very efficient to create, but must always be a single type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With