Here we give a list of things which are possible in Free Pascal, but which didn’t exist in Turbo
Pascal or Delphi.

Free Pascal functions can also return complex types, such as records and arrays.

In Free Pascal, you can use the function return value in the function itself, as a variable. For
example:

function a : longint;

begin
a:=12;
while a>4 do
begin
{...}
end;
end;

The example above would work with TP, but the compiler would assume that the a>4 is a
recursive call. If a recursive call is actually what is desired, you must append () after the
function name:

function a : longint;

begin
a:=12;
{ this is the recursive call }
if a()>4 then
begin
{...}
end;
end;

In Free Pascal, there is partial support of Delphi constructs. (See the Programmer’s Guide for
more information on this).

The Free Pascal exit call accepts a return value for functions.

function a : longint;

begin
a:=12;
if a>4 then
begin
exit(a*67); {function result upon exit is a*67 }
end;
end;

Free Pascal supports function overloading. That is, you can define many functions with the
same name, but with different arguments. For example:

procedure DoSomething (a : longint);
begin
{...}
end;

procedure DoSomething (a : real);
begin
{...}
end;

You can then call procedure DoSomething with an argument of type Longint or
Real.This feature has the consequence that a previously declared function must always be defined
with the header completely the same: