I have two arrays,
a = [1, 2]
b = [:a]
I want to get the result as
[[1, :a], [2, :a]]
Is there any methods for this?
Use the Array#product:
a = [1, 2]
b = [:a]
a.product(b)
=> [[1, :a], [2, :a]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With