Hi Friends,
However in practice we often require to select elements of the array in pairs. It’s very easy to do it with ruby array. Here is an example for the same:
Example
each_slice
method slice the original array in the given number of size.If you want to pick 5
elements of the array then just modify above example by this: