Script structure

The PascalScript structure is the same as in Object Pascal language:


#language PascalScript // this is optional
program MyProgram;     // this is optional

uses 'unit1.pas', 'unit2.pas';   
// uses section - must be before any other sections
// v1.2 changes: warning! the included units are not inserted into the main unit text. So it can have
// 'program', 'uses' sections and must have the 'main procedure' section.

var                    // var section
  i, j: Integer;

const                  // const section
  pi = 3.14159;

procedure p1;          // procedures and function
var
  i: Integer;

  procedure p2;        // nested procedure
  begin
  end;

begin
end;

begin                  // main procedure that will be executed.
end.

The C++Script structure is:


#language C++Script // this is optional
#include "unit1.cpp", "unit2.cpp"  
// uses section - must be before any other sections

int i, j;              // var section

#DEFINE pi = 3.14159   // const section

void p1()              // procedures and function
{                      // there is no nested procedures in C++Script
}

{                      // main procedure that will be executed.
}

The JScript structure is:


#language JScript // this is optional
import "unit1.js", "unit2.js"  
// import section - must be before any other sections

var i, j = 0;          // var section

function p1()          // procedures and function
{                      // 
}
                       // main procedure that will be executed.  
p1();
for (i = 0; i < 10; i++) j++;

The BasicScript structure is:


#language BasicScript // this is optional
imports "unit1.vb", "unit2.vb"  
// imports section - must be before any other sections

dim i, j = 0           // var section

function f1()          // procedures and function
end function           //

sub p1()
end sub
                       // main procedure that will be executed.  
for i = 0 to 10
  p1()
next