Ruby - Arrays
What is the output of the following Ruby code?
arr = Array.new(4) { |i| i * 2 }
puts arr.inspectarr = Array.new(4) { |i| i * 2 }
puts arr.inspecti.i * 2: 0*2=0, 1*2=2, 2*2=4, 3*2=6.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions