Typed constants


  Typed constants

 Typed constants are similar to initialized variables (variables whose
 values are defined on entry to their block).

 Unlike an untyped constant, the declaration of a typed constant specifies
 both the type and the value of the constant.

 Typed constants can be used exactly like variables of the same type, and
 can appear on the left side in an assignment statement.

 Note: Typed constants are initialized only once--at the beginning of a
 program. For each entry to a procedure or function, the locally-declared
 typed constants are not reinitialized.

 In addition to a normal constant expression, the value of a typed constant
 can be specified with a constant address expression.


 (* Typed Constant Declarations *)
   Point = record X, Y: real end;
   Minimum: Integer = 0;
   Maximum: Integer = 9999;
   Factorial: array[1..7] of Integer = (1, 2, 6, 24, 120, 720, 5040);
   HexDigits: set of Char = ['0'..'9', 'A'..'Z', 'a'..'z'];
   Origin: Point = (X: 0.0; Y: 0.0);

See Also

Код для вставки: :: :: :: ::
Поделиться: // //