When passing objects as parameters, are they passed by reference?

后端 未结 5 558
名媛妹妹
名媛妹妹 2021-01-12 12:01

Is there any performance implications if I do either of these:

def do_something(user, article)
...
end

versus

def do_someth         


        
5条回答
  •  一生所求
    2021-01-12 12:40

    Well everything is an Object in ruby (everything inherits from Object) and ruby always passes objects by ref so both of your examples are passing by reference!

提交回复
热议问题