I ran across an unexpected result when passing an array to a function and the behavior of << vs +=.
<<
+=
Can anyone explain why the following
My understanding is that in Ruby all function arguments are passed by reference
No, as you have discovered yourself, Ruby is pass-by-value, not pass-by-reference. That's why you are seeing the result you are seeing.