DEV Community

Discussion on: 4 lesser known ways to use Rubyโ€™s Enumerable module

Collapse
 
sannim1 profile image
Abdulmusawwir Sanni

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 ๐Ÿ™‚

Collapse
 
dzello profile image
Josh Dzielak ๐Ÿ”†

Thanks for reading!

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