Variables

From SCAR Divi Manual
Jump to: navigation, search

Variables are fields which contain non-permanent data, meaning you can change the contents of them at any time. A variable is defined as a name and type. The name can be anything matching [_A-Za-z][_A-Za-z0-9]*, the type should already be declared when you use it, this can be an array, a regular basic or structured type, a (internally defined) set or finally a class. The declaration of a variable can either be global or local, in both cases the var keyword is used to define them.

In case of a global variable, it is defined outside of a function.

var
  i: Integer;

In case of a local variable, it is defined inside of a function and not available on a global scope, just inside of the function where it was defined.

procedure Proc;
var
  i: Integer;
begin
  // Code
end;