Professional Documents
Culture Documents
Pass by Value Vs Pass by Reference
Pass by Value Vs Pass by Reference
on several factors, including the size of the data, the need for modification, and
performance considerations. But my personal opinion is the decision should be based
off of the following:
In summary:
- If you don't want to change the value of the argument you're passing through a
function we pass by VALUE.
- If you want to change the value of the argument you're passing through a function
we pass by REFERENCE.
It's also important to note that this can completely depend on how the logic behind
your function works, it's up to you to code the logic behind your functions
and make your functions work as you intended them to.