re: 4 lesser known ways to use Ruby’s Enumerable module VIEW POST

FULL DISCUSSION
 

Great article. Thanks for sharing this knowledge 🙏


However, the first element of the next array is the last element of the previous

While describing the behaviour of each_cons, you mention the above. I think that may not be 100% accurate in all cases, as the first element of the next array is actually the second element of the previous.

It just so happens to be correct for the accompanying example because the returned arrays are of size 2.

Hope that makes sense 🙂

 

Thanks for reading!

Good catch there 😅 I've updated the post to state that correctly, thank you for pointing it out.

code of conduct - report abuse