From 91f279c83749288315f709e7dc4b83e2429d98a9 Mon Sep 17 00:00:00 2001 From: Cameron Bisca Date: Sat, 10 Oct 2020 23:36:51 +0000 Subject: [PATCH] Done. --- square_array.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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