Declaring Sets

suggest change

Sets are unordered collections of unique values. Unique values must be of the same type.

var colors = Set<String>()

You can declare a set with values by using the array literal syntax.

var favoriteColors: Set<String> = ["Red", "Blue", "Green", "Blue"]
// {"Blue", "Green", "Red"}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents