Difference between revisions of "Global variables"
From Free Pascal wiki
Jump to navigationJump to searchm |
|||
Line 3: | Line 3: | ||
A global [[Variable|variable]] is a variable that is declared in the main section of a [[Program|program]] or the [[Interface|interface]] part of a [[Unit|unit]]. Globals declared in a program cannot be accessed from within a unit. Globals declared in a unit can be accessed from within a program or another unit. | A global [[Variable|variable]] is a variable that is declared in the main section of a [[Program|program]] or the [[Interface|interface]] part of a [[Unit|unit]]. Globals declared in a program cannot be accessed from within a unit. Globals declared in a unit can be accessed from within a program or another unit. | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="pascal"> |
program GlobalVariables; | program GlobalVariables; | ||
var | var |
Revision as of 12:13, 23 June 2019
│
English (en) │
suomi (fi) │
русский (ru) │
A global variable is a variable that is declared in the main section of a program or the interface part of a unit. Globals declared in a program cannot be accessed from within a unit. Globals declared in a unit can be accessed from within a program or another unit.
program GlobalVariables;
var
g: integer;
begin
end.
g is a global variable.
External variable
External variable is a global variable has been declared in unit interface section.