Today's Pascal —as being used by FPC and Delphi since ages ago— has result variable declared implicitly within a function. This doesn't work in Pascal N-IDE.
Example:
function f(p: integer): string;
// var result: string <-- implicitly added by the compiler
begin
if p = 0 then
result := 'zero'
else
result := intToStr(p);
end;
Because result is a variable, it acts like a variable. For example, if the function output is a dynamic array, the result size can be defined by setLength() procedure from within the function.
Today's Pascal —as being used by FPC and Delphi since ages ago— has
result
variable declared implicitly within a function. This doesn't work in Pascal N-IDE.Example:
Because
result
is a variable, it acts like a variable. For example, if the function output is a dynamic array, theresult
size can be defined bysetLength()
procedure from within the function.Reference: https://www.freepascal.org/docs-html/current/ref/refse90.html#x174-19600014.3