Difference between revisions of "Var"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
 +
{{Var}}
 +
 
[[Keyword]] which is used to mark section, where [[Variable|variables]] and their data [[Type|type]]s are declared. When declared parameter of the [[Procedure|procedure]] or [[Function|function]] '''var''' indicated by the use of [[Variable parameter|variable parameter]].
 
[[Keyword]] which is used to mark section, where [[Variable|variables]] and their data [[Type|type]]s are declared. When declared parameter of the [[Procedure|procedure]] or [[Function|function]] '''var''' indicated by the use of [[Variable parameter|variable parameter]].
 
   
 
   
Line 7: Line 9:
 
Second is the [[Type|type]] of variable. This is followed by a [[Semicolon|semicolon]].
 
Second is the [[Type|type]] of variable. This is followed by a [[Semicolon|semicolon]].
 
   
 
   
<delphi>  
+
<delphi> ...
 
+
var
  var
 
 
     age : integer ;
 
     age : integer ;
 
+
...</delphi>  
</delphi>  
 
  
 
If you are planning to use various variables of the same type, you can declare more than on in  
 
If you are planning to use various variables of the same type, you can declare more than on in  
 
first part. The variables must be separated with a [[Comma|comma]].
 
first part. The variables must be separated with a [[Comma|comma]].
  
<delphi>  
+
<delphi> ...
 
+
var
  Var
 
 
     man, woman : human ;
 
     man, woman : human ;
 
+
...</delphi>  
</delphi>  
 
 
 
 
 
  
 
== Read more ==
 
== Read more ==

Revision as of 20:16, 8 January 2010

Deutsch (de) English (en) español (es) suomi (fi) français (fr) русский (ru) 中文(中国大陆)‎ (zh_CN)

Keyword which is used to mark section, where variables and their data types are declared. When declared parameter of the procedure or function var indicated by the use of variable parameter.

Variables are declared at the beginning of the program, procedure, function or unit.


Variables are declared in two parts. First is then name of variable. This is followed by a colon. Second is the type of variable. This is followed by a semicolon.

<delphi> ...

var
   age : integer ;
...</delphi> 

If you are planning to use various variables of the same type, you can declare more than on in first part. The variables must be separated with a comma.

<delphi> ...

var
   man, woman : human ;
...</delphi> 

Read more