Is there a way to return the new array? I try to return the array of squared value [1, 4, 9] but it keeps returning [1, 2, 3] (the original array) Here is my code:
def square_array(array)
array.each do |number|
number *= number
puts number
end
end
square_array([1, 2, 3])