Difference between revisions of "Local variables"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{Local variables}}
 
{{Local variables}}
  
a local variable is defined in a [[Procedure|procedure]] or [[Function|function]]
+
A local [[Variable|variable]] is defined inside a [[Procedure]], [[Function]], [[Method]] or the [[Implementation|implementation]] section of a [[Unit]] and is only accessible from there. It is said to have local scope and cannot be accessed from outside (i.e. by another outside procedure, function or unit).
  procedure DoSoemthing;  
+
 
  var x:type
+
<syntaxhighlight lang=pascal>
 +
  procedure DoSomething;  
 +
  var  
 +
  x : Tsome_type;
 
  begin
 
  begin
  end
+
 
 +
  end;
 +
</syntaxhighlight>
 +
 
 +
== Read More ==
 +
* [[Var]]
 +
* [[Global variables]]

Latest revision as of 02:44, 19 February 2020

Deutsch (de) English (en) español (es) suomi (fi) русский (ru)

A local variable is defined inside a Procedure, Function, Method or the implementation section of a Unit and is only accessible from there. It is said to have local scope and cannot be accessed from outside (i.e. by another outside procedure, function or unit).

 procedure DoSomething; 
 var 
  x : Tsome_type;
 begin
  
 end;

Read More