Consume the remaining elements of a Zip

If you print the sum after running the code you posted, you will understand why zip doesn't let you get back the inner iterators. Doing so will lose the first extra message in the longer iterator, and to avoid it, you need some sort of peeking construct to not consume the message when checking if we are at the end.

It will print 6, not 9.

2 Likes