Ruby - Enumerable and Collection Processing
Identify the error in this Ruby code snippet:
arr = [1, 2, 3, 4]
result = arr.flat_map { |x| x * 2 }
puts result.inspectarr = [1, 2, 3, 4]
result = arr.flat_map { |x| x * 2 }
puts result.inspect{ |x| x * 2 } returns integers, not arrays or enumerables.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions