Var

From Lazarus wiki
Revision as of 15:05, 24 March 2012 by Vincent (talk | contribs) (Text replace - "delphi>" to "syntaxhighlight>")
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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