Script structure

<< Click to Display Table of Contents >>

Navigation:  Script Language >

Script structure

Script has the following structure: (all sections are optional)

 

[program <name>; | unit <name>; ]

[interface]

[uses <unit list>]

[const and functions declarations]

[main code block | implementation]

 

[initialization]

 

Example:

 
const 
  MyText = 'Sample text';
 
procedure Sample(s: string);
begin
  ShowMessage(s);
end;
 
Sample(MyText);
 

 

Example of unit:

 

unit MyTest;
 
interface
 
function MyInttoStr(Value: integer): string;
 
implementation
 
function MyInttoStr(Value: integer): string;
begin
  if Value = 0 then
    Result := ''
  else
    Result := InttoStr(Value)
end;
 
end.