0

What is the difference between array and set in swift

8th Aug 2019, 7:03 AM
magad
magad - avatar
3 Antworten
+ 1
This doesn't necessarily conform to Swift but to all languages, array is like a list containing multiple values while set is like an array, but it contains ONE instance of any value. Examples: Array {1, 2, 1, 3} has two 1's Set {1, 2, 3} can only have one 1
8th Aug 2019, 9:41 AM
Qermon
Qermon - avatar
+ 1
That's all differences?
8th Aug 2019, 11:45 AM
magad
magad - avatar
+ 1
Sets in Swift are unordered
8th Aug 2019, 11:51 AM
Qermon
Qermon - avatar