Difference between revisions of "Global variables"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
A global [[Variable|variable]] is defined in [[Standard Pascal|standard pascal]] into [[main program]]
+
A global [[Variable|variable]] is one that is defined in the [[main program]] of a program or the main part of a unit. Globals declared in a program cannot be accessed from a unit, but globals in a unit can be accessed from a main program or a unit that accesses that unit.
 +
 
  
  main_program;
 
 
   var
 
   var
 
     i:integer;
 
     i:integer;
 +
 
   begin
 
   begin
 
   end.
 
   end.

Revision as of 22:05, 13 January 2012

A global variable is one that is defined in the main program of a program or the main part of a unit. Globals declared in a program cannot be accessed from a unit, but globals in a unit can be accessed from a main program or a unit that accesses that unit.


 var
   i:integer;
 begin
 end.

i is a global variable.


External variable

External variable is a global variable has been declared in unit interface section.

Read More