Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. var array = ["1","2","3"]
  2. print(array[0])
  3. //1
  4. array.remove(at: 0)
  5. print(array[0])
  6. //2
  7.  
  8. var dict = [
  9. "1":"One",
  10. "2":"Two",
  11. "3":"Three"
  12. ]
  13.  
  14. if let value = dict["1"]{
  15. print(value)
  16. //One
  17. }
  18.  
  19. if let index = dict.index(forKey:"1"){
  20. dict.remove(at: index)
  21. print(dict)
  22. //["2":"Two","3":"Three"]
  23. }
Add Comment
Please, Sign In to add comment