From
Exit:
Exit exits the current subroutine, and returns control to the calling routine...
The
optional argument X allows to specify a return value, in the case Exit is invoked in a function.
From
Function results:
The result of a function can be set by setting the result variable: this can be the function identifier or, (only in ObjFPC or Delphi mode)
the special Result identifier:
As an extension to Delphi syntax, the ObjFPC mode also supports a
special extension of the Exit procedure...The Exit call sets the result of the function and jumps to the final End.
I.e. Exit(X) is Result := X and Exit;