Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. //Zip function (Sequence)
  2.  
  3. let array1 = ["one", "two", "three", "four", "five"]
  4. let array2 = 1...5
  5.  
  6. let zipSequence = zip(array1, array2)
  7. type(of: zipSequence) //Zip2Sequence<Array<String>, CountableClosedRange<Int>>.Type
  8.  
  9. zipSequence.forEach { (key, value) in
  10. print("key: \(key), value: \(value)")
  11. }
  12.  
  13. //key: one, value: 1
  14. //key: two, value: 2
  15. //key: three, value: 3
  16. //key: four, value: 4
  17. //key: five, value: 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement