Declaration and variable inizialization
Previous  Top  Next


Variables consisting of a name and a type: NameVAR := ….

Example 1:
// String variable 
Text:= 'Welcome';

Example 2:
// Whole type variable 
Var:= 16;

Example 3:
// Hexadecimal variable(A16=1010)
HexVar:=$A;

Example 4:
// ASCII variable (65=A)
AsciiVar:=#65;

Example 5:
//Boolean variable initialized 
by an expression
//that checks the file existence 
Esistente:=FileExists('c:\fatture.db');

The following example shows when the variable is not used in the right way.

Var:='Carlo'
……it executes other instructions…
Var:=14

The variable Var is initialized with a word, so it becomes a string type variable. Then it is tried to replace the first value with a integer number, but there is a mistake because the variable cannot contain different values from the string type (which it is initialized with).
So that the variable Var has the value14 it needs to put the number into inverted commas, then14 will not be a number but it will become a string:
Var:='14.

The error message displayed during the script execution will be: "Runtimeerror: Variable NameVariabile expects type ARRAY STRING instead of type ARRAY INTEGER [Position N] ".