Difference between revisions of "Var"

From Lazarus wiki
Jump to navigationJump to search
Line 31: Line 31:
 
* [[doc:/ref/refse19.html#x49-540004.2|Variable declaration]]
 
* [[doc:/ref/refse19.html#x49-540004.2|Variable declaration]]
 
* [[doc:/ref/refse21.html#x51-560004.4|Thread Variables]]
 
* [[doc:/ref/refse21.html#x51-560004.4|Thread Variables]]
 +
* [http://www.cs.joensuu.fi/~saja/var_roles/| The Roles of Variables]
  
 
[[category:Pascal]]
 
[[category:Pascal]]

Revision as of 07:52, 6 August 2008

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