'Declare const with variable values

in other PL we can declare const Test = 'my test '+inc(someVar)+' is work';
how to simulate this in delphi?
my delphi example may be like that:

const
  Msg = 'some todo-Tasks will Start in [ '+Timer1.Tag.ToString+' ] Seconds.';


Solution 1:[1]

In modern versions of Delphi, this can be achieved by means of inline variable (and constant) declarations:

begin
  // code
  const Msg = 'Some text ' + (a + b).ToString + '.';
  // more code...

Classical (non-inline) Delphi constant declarations cannot contain non-constant expressions; they are evaluated at compile time. An inline constant declaration like the one above, on the other hand, is executed at runtime as a statement. The RHS can be any valid expression. You can think of this as declaring a read-only variable with local scope and the statement being an ordinary variable assignment.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1