Function arguments
So far, we have been discussing the syntax of functions in Julia and how to create one when required. One very important aspect when we talk about functions are arguments. Undoubtedly, we have been using them freely in almost every other language, knowing that they may be either passed by a value or a reference.
But Julia is different. Julia follows a convention knows as pass by sharing! Wait, now what does pass by sharing mean? For this, let's first go back to the two most commonly used conventions.
Pass by values versus pass by reference
When we say pass by value, it means that the value of whatever is passed to a function as an argument will be copied into that function, meaning that two copies of the same variable will be passed.
On the other hand, when we say pass by reference, the reference or location of whatever is passed to the function is also passed into that function, meaning that only one copy of the variable will be passed.
Pass by sharing
In pass by sharing, we...