Since you don't know what passing argument by reference means Ill start with this.
Usually, when calling a function, you will do so passing parameters by value. That means you are sending values as parameters, not variables.
So if I call:
a = 10;
some_func(a);
That's basically the same as calling:
some_func(10);
Since you are actually sending the value contained in a and not the actual variable a.
But what if you wanted your function to actually change the value in a? In this case you need to send the argument of the function as a reference so the variable itself is provided to the function. Here is an example:
void sum( int a, int b, ref int c )
{
c = a + b;
}
As you can see in the function above, the function is receiving a and b by value, because it does not intend on changing them. But c is passed by reference, because we intend to put the result of the function in this variable.
Now to the difference between ref and out.
If you try to call the function above, you might get a compilation error telling you you are sending an uninitialized variable to the function.
But that should not be an issue (in this case) because my referenced variable is actually an output so I don't really care what was the previous value stored in it.
So instead of declaring this variable with the ref keyword, I can use out keyword and that let's the compiler know this variable is only an output so it does not need to check if it has been initialized