Ruby - Loops and Iteration
Find the error in this Ruby code snippet:
array = [10, 20, 30]
array.each { |x| x = x + 5 }
puts array.join(',')array = [10, 20, 30]
array.each { |x| x = x + 5 }
puts array.join(',')x = x + 5 changes only the block variable, not the array elements.puts array.join(',') prints '10,20,30'.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions