What is the difference between these:
function Something(Val: Integer): Boolean;
and
function Something(Var Val: Integer): Boolean;
In the first case, the function Something receives copy of the parameter Val. Although you can change Val's value within Something, any changes you make to Val are lost as soon as you leave the function. This is called passing a parameter by value.
In the second case, the parameter is an actual reference to the original variable Val. Any changes you make to Val within Something affect Val permanently, because you are not dealing with a temporary copy of Val, but with Val itself. This is called passing a parameter by reference.
In other words, reading the value of Val is identical in both parameter conventions, but writing to Val, although allowed when passing by value, has no permanent effect on the value of Val in the first case, whereas writing to Val when passed by reference changes its value.