diff --git a/array_copy.rb b/array_copy.rb new file mode 100644 index 0000000..103cc4c --- /dev/null +++ b/array_copy.rb @@ -0,0 +1,10 @@ +# array_copy.rb + +def array_changer array + array << 6 +end + +some_array = [1, 2, 3, 4, 5] +p some_array +array_changer Marshal.load(Marshal.dump(some_array)) +p some_array diff --git a/array_passed_to_function.rb b/array_passed_to_function.rb new file mode 100644 index 0000000..ee25a66 --- /dev/null +++ b/array_passed_to_function.rb @@ -0,0 +1,10 @@ +# array_passed_to_function.rb + +def array_changer array + array << 6 +end + +some_array = [1, 2, 3, 4, 5] +p some_array +array_changer some_array +p some_array