Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zip function (Sequence)
- let array1 = ["one", "two", "three", "four", "five"]
- let array2 = 1...5
- let zipSequence = zip(array1, array2)
- type(of: zipSequence) //Zip2Sequence<Array<String>, CountableClosedRange<Int>>.Type
- zipSequence.forEach { (key, value) in
- print("key: \(key), value: \(value)")
- }
- //key: one, value: 1
- //key: two, value: 2
- //key: three, value: 3
- //key: four, value: 4
- //key: five, value: 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement