Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Arrays
- var numbers:[Int] = Array(repeating: 0, count: 10)
- numbers[5] = 5
- print (numbers)
- var names:[String] = Array()
- // Sets
- var favoriteArtists: Set<String> = ["Weeknd", "Rihanna", "Seether"]
- favoriteArtists.insert("Alo")
- favoriteArtists.insert("Seether")
- print(favoriteArtists)
- // Dictionary
- var places: [String:(lat: Double, lon: Double)] = ["Sofia":(42.7, 23.3), "Vienna":(48.12, 16.22), "San Francisco":(37.47, -122.25)]
- print(places["Sofia"]?.lat)
- places["Barcelona"] = (47.23, 2.11) // insert
- places["Sofia"] = (42.65, 23.34) // modify
- places.removeValue(forKey: "Sofia") // removes element
- places["Barcelona"] = nil
- print(places)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement