q1xlbg
Last Updated: February 25, 2016
·
543
· kormie
2d63741c66663e0f8d59b012ca17cdc3

Enumerable#partition

Ever want to do a select and reject at the same time? Use partition. Here's a super fast way to get all the evens and odds from 1 to 100.

even, odd = [*1..100].partition(&:even?)
Say Thanks
Respond