Can someone please explain in simple terms, why when I do
r:=foo(r), where "r" is a Record, then the returned "r" is not what is returned from foo()? I want to write a proc foo() which takes in a Record variable, update some of its fields, and then return the updated Record to the caller
But now when I call the above as follows
The last print above just prints "r" and not the Record. It seems to have erased the Record.
But it works, if I change the name of the variable to return the result into, as
When I do the same on say a Matrix, there is no problem
Why it worked with a Matrix but not with Record? Why can't one overwrite the Record on the call return?
What would be the correct way to pass in a Record to a function, and have the function update some of its fields, and then return back the updated copy of the Record without having to make a new variable "r0" as above?