The project is located at: C: \ Project \, it also contains the files file1.txt and file2.txt .

When you try to knock a project, 3 errors pop up. I do not understand why?

 const ComFileHandle: array[3..4,1..2] of integer = ((-1,-1),(-1,-1)); 

...

 function InitComFiles(NBlok: byte): byte; var I : byte; const CodeErr: array[3..4,1..2] of byte = ((13, 23),(14, 24)); Res: array[1..2] of byte = (0,0); begin Result:= $F; for I:= 1 to 2 do begin ComFileHandle[NBlok, I]:= FileOpen(Format('file%d.txt',[I]), $40); //Error if ComFileHandle[NBlok, I] < 0 then begin Res[I]:= CodeErr[NBlok,I]; //Error Result:= Res[I]; end; end; if (Res[1]= CodeErr[NBlok,1]) and (Res[2]= CodeErr[NBlok,2]) then begin Result:=NBlok; Exit; end; if MassivList[NBlok]= nil then MassivList[NBlok]:= TList.Create //Error else MassivList[NBlok].Clear; OpenBD(NBlok); end; 

Mistake:

[Pascal Error] E2064 Left side cannot be assigned to

  • And at the same time, check the return type of FileOpen , does it really have a Byte dimension in your Delphi version? - Kromster
  • You yourself declared their constants - Nikolay Fomenko

1 answer 1

The error is obvious, you are trying to assign new values ​​to constants. A message to you about the same and says: "Left side cannot be assigned to" - "you can not assign a value to the left side"


Delphi also has an instruction for the compiler that will allow you to assign new values ​​to typed constants:

 {$WRITEABLECONST ON} const AssignableConst: Integer = 0; {$WRITEABLECONST OFF} ... AssignableConst := 123; 

It is also available in Project Settings -> Options -> Compiler -> Assignable typed Constants.