Named variables are introduced in variable declarations, which define the type of each variable, and associate an identifier (i.e. a name) with each variable.
Named variables are created when the block containing their variable declaration is activated, and destroyed when the activation of the block is terminated. In the case of variables introduced in the variable declarations of the main program block, this means that these variables will be created when the program is activated, and destroyed when the program is terminated. In the case of variables introduced in the variable declarations of function or procedure blocks, this means that these variables will be created when the function or procedure is activated, and destroyed when the function or procedure is terminated.
Named variables are referenced simply by using their names (i.e. the identifiers associated with the variables).
For example below is a simple program that introduces an integer variable, associates the variable identifier n with the new variable, stores 100 in the the variable, retrieves the value stored in the variable, and displays the value on the screen.
program number(output);
var
n : integer; (* declare variable 'n' of type 'integer' *)
begin
n := 100; (* Store 100 in the variable *)
writeln(n) (* Retrieve the value in the variable and display it on the screen *)
end.