Avoiding copies of method arguments

Hello!

v = ‘abc’

some-method(v)

This will send a copy of v to the method, right? If so, how does one
avoid this. How can one send the original and avoid the extra
consumption of resources from copying? Thanks!

Hello Justin!

No, this will not send a copy of v to some_method, but v itself.

Cheers,
Arthur

Great, thanks so much!

Just test it out:

irb >> def change(str)
irb >> str << ‘z’
irb >> end
irb => nil
irb >> v
irb => “abc”
irb >> change(v)
irb => “abcz”
irb >> v
irb => “abcz”