Node:Variable Declaration, Next:, Previous:Type Declaration, Up:Source Structures



Variable Declaration

A variable declaration looks like this:

var
  var_identifier: type_identifier;
  ...
  var_identifier: type_identifier;
or
var
  var_identifier: type_definition;
  ...
  var_identifier: type_definition;
and with initializing value:
var
  var_identifier: type_identifier value constant_expression;
  ...
  var_identifier: type_identifier value constant_expression;
or
var
  var_identifier: type_definition value constant_expression;
  ...
  var_identifier: type_definition value constant_expression;

A variable declaration part begins with the reserved word var. It declares a var_identifier whose type either can be specified by a type identifier, or by a type definion which either can be an array, a record, a set, a subrange, an enumerated type or a pointer to an type identifier. If value is specified followed by a constant expression satisfying the specified type, the variable declared is initialized with constant_expression. The reserved word value can be replaced by =, however value is not allowed in ISO-Pascal and Borland Pascal, and the replacement by = is not allowed in Extended Pascal.

See also

Type Definition, Type Declaration, Data Types, The Declaring Statement, Subroutine Parameter List Declaration