Typed constants serve to provide a program with initialised variables. Contrary to ordinary constants, they may be assigned to at run-time. The difference with normal variables is that their value is initialised when the program starts, whereas normal variables must be initialised explicitly.
_________________________________________________________________________________________________________
Typed constant declaration
___________________________________________________________________
Given the declaration:
Const S : String = 'This is a typed constant string'; |
S := 'Result : '+Func; |
Const tt : array [1..3] of string[20] = ('ikke', 'gij', 'hij'); ti : array [1..3] of Longint = (1,2,3); |
Type Point = record X,Y : Real end; Const Origin : Point = (X:0.0; Y:0.0); |
Remark: It should be stressed that typed constants are initialized at program start. This is also true for local typed constants. Local typed constants are also initialized at program start. If their value was changed during previous invocations of the function, they will retain their changed value, i.e. they are not initialized each time the function is invoked.