Difference between revisions of "Var"

From Lazarus wiki
Jump to navigationJump to search
m (Text replace - "delphi>" to "syntaxhighlight>")
Line 9: 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> ...
+
<syntaxhighlight> ...
 
  var
 
  var
 
     age : integer ;
 
     age : integer ;
  ...</delphi>  
+
  ...</syntaxhighlight>  
  
 
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> ...
+
<syntaxhighlight> ...
 
  var
 
  var
 
     man, woman : human ;
 
     man, woman : human ;
  ...</delphi>  
+
  ...</syntaxhighlight>  
  
 
== Read more ==
 
== Read more ==

Revision as of 16:05, 24 March 2012

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.

 ...
 var
    age : integer ;
 ...

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.

 ...
 var
    man, woman : human ;
 ...

Read more