Type Switch Syntax {$J+} or {$J-} {$WRITEABLECONST ON} or {$WRITEABLECONST OFF} Default {$J+} {$WRITEABLECONST ON} Scope Local The $J directive controls whether typed constants can be modified or not. In the {$J+} state, typed constants can be modified, and are in essence initialized variables. In the {$J-} state, typed constants are truly constant, and any attempt to modify a typed constant causes the compiler to report an error. In previous versions of Delphi and Borland Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state.
const
A: Integer = 10;
使用中可以进行赋值.
Syntax {$J+} or {$J-}
{$WRITEABLECONST ON} or {$WRITEABLECONST OFF}
Default {$J+}
{$WRITEABLECONST ON}
Scope Local
The $J directive controls whether typed constants can be modified or not. In the {$J+} state, typed constants can be modified, and are in essence initialized variables. In the {$J-} state, typed constants are truly constant, and any attempt to modify a typed constant causes the compiler to report an error.
In previous versions of Delphi and Borland Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state.