IPB

> Typed constants
Форум
Загрузка...
 
Час быка
Час быка
Карта Интернета
Internet Map
Яндекс.Метрика

Language:
Русский
English

  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.

Examples

 (* Typed Constant Declarations *)
 type
   Point = record X, Y: real end;
 const
   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

 
 К началу страницы 
 

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


-
Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"