<< Click to Display Table of Contents >> Navigation: Script Language > Function declaration |
Script function has the following structure:
procedure|function <name>( [parameters] ) [: <result type>]);
[ var <variables>; ]
begin
<function body>
end;
function Substring(s: string; Start, Len: integer): string;
begin
Result := copy(s, Start, Len)
end;
functions can have default parameters.
Example:
function Substring(s: string; Start: integer = 1; Len: integer = MaxInt): string;
begin
Result := copy(s, Start, Len)
end;