Var

From Lazarus wiki
Revision as of 07:52, 6 August 2008 by Djzepi (talk | contribs)
Jump to navigationJump to search

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