Node:The Declaring Statement, Next:Loop Control Statements, Previous:Procedure Call, Up:Statements

##### The Declaring Statement

This statement allows to declare a variable within a statement part. It looks like this:

    var
      var_identifier: type_identifier;

or

    var
      var_identifier: type_definition;

and with initializing value:

    var
      var_identifier: type_identifier value expression;

or

    var
      var_identifier: type_definition value expression;

Unlike in declaration parts, the initializing expression does not have to be a constant expression. Note that every declaring statement has to start with `var`. The name space of the variable extends from its declaration to the end of the current matching statement sequence (which can be a statement part (of the program, a function, a procedure or an operator) or, within that part, a begin end compound statement, a repeat loop, or the else branch of a case statement). This statement is a GNU Pascal extension.

#### See also

Type Definition, Data Types