The Delphi compiler was expecting a constant expression here, but the expression it found was not constant.
program Produce;
const
Message = 'Hello World!';
WPosition = Pos('W', Message);
begin
end.Even though its parameters are constants, the call to Pos is not a constant expression to the compiler, and it might theoretically be evaluated at compile time.
program Solve; const Message = 'Hello World!'; WPosition = 7; begin end.
Leave a Reply