|
Variables
If you are familiar with Spreadsheet
modeling then you'll know that variables are data that can change
(vary). In Delphi if you want to store Data then you store it in a
variable. Before you use a variable, you need to declare it (assign
memory to it).
Declaring
Variables
Variables are declared with the
keyword Var. They are declared in the following way:
Var varname : datatype;
varname : The name of the variable.
datatype : The type of Data it will hold.
e.g. A variable which holds a
person's nickname would be declared like this:
Var Nickname : String;
Knowing that each statement can take
more than one line means that it can also be written like
this:
Var
Nickname : String;
When you declare more than one
variable, you still only use the word 'Var' once:
Var
Nickname : String;
Firstname : String;
Lastname : String;
Age : Integer;
|