RAD Studio Athens

E2195

Go Up to Error and Warning Messages (Delphi)

The compiler disallows the use of initialized local variables.


program Produce;

  var
    jย : Integer;

  procedure Show;
    var iย : Integer = 151;
  begin
  end;

begin
end.

The declaration and initialization of 'i' in procedure 'Show' is illegal.


program Solve;

  var
    jย : Integer;

  procedure Show;
    var iย : Integer;
  begin
    iย := 151;
  end;

begin
  jย := 0;
end.

You can use a programmatic style to set all variables to known values.