Fork me on GitHub

Alex Rupérez

Link: http://j.mp/2QPMLR7
Published: 14 Jan 15:56
I starred NSHipster/Cycle at GitHub.
A sequence that cycles between each of the items in a given sequence.
View on GitHub


View README


Cycle

A sequence that cycles between each of the items in a given sequence.

for (number, parity) in zip(0..<5, ["even", "odd"].cycled()) {
    print(number, parity)
}
// Prints:
// 0 even
// 1 odd
// 2 even
// 3 odd
// 4 even

License

MIT

Contact

Mattt (@mattt)