Converting ruby array to array of consecutive pairs

后端 未结 2 1086
清酒与你
清酒与你 2020-12-03 09:42

What is the easiest way to convert a ruby array to an array of consecutive pairs of its elements?

I mean:

x = [:a, :b, :c, :d]

Expe

2条回答
提交回复
热议问题