[fpc-devel] Explicitly named return values and implicit aliases Result

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Dec 16 12:07:10 CET 2020


On Wed, 16 Dec 2020 10:24:39 +0100 (CET)
Michael Van Canneyt via fpc-devel <fpc-devel at lists.freepascal.org>
wrote:

>[...]
> Function MyResult : String;
> 
> begin
>    Result:='';
>    MyResult:='';
> end;
> 
> You can still use the function name for the result, so "Result" is in
> fact an alias for the function name, which is the actual name for the
> result value.

That is not entirely correct.

Function MyResult : String;
begin
   Result:=Result; // the current result
   MyResult:=MyResult; // recursive call
end;

Mattias


More information about the fpc-devel mailing list