diff --git a/square_array.rb b/square_array.rb index 852a8fe32..a2425d91d 100644 --- a/square_array.rb +++ b/square_array.rb @@ -1,3 +1,10 @@ +array = [1, 2, 3] + def square_array(array) - # your code here -end \ No newline at end of file + new_array = [] + array.each { |number| new_array << number ** 2 } + new_array +end + +#A Note on Return Values +#Different iterators have different return values. Notice that the return value of the call to #each above returned ["Tim", "Tom", "Jim"] – the #original array. The #each method will always return the original collection on which it was called. \ No newline at end of file