Delphi Error – E2066 Missing operator or semicolon

Delphi Compiler Error

E2066 Missing operator or semicolon

Reason for the Error & Solution

This error message appears if there is no operator between two subexpressions, or no semicolon between two statements.

Often, a semicolon is missing on the previous line.

program Produce;
var
  I: Integer;
begin
  I := 1 2                 (*<-- Error message here*)
  if I = 3 then            (*<-- Error message here*)
  Writeln('Fine')
end.

The first statement in the example has two errors – a ‘+’ operator and a semicolon are missing. The first error is reported on this statement, the second on the following line.

program Solve;
var
  I: Integer;
begin
  I := 1 + 2;              (*We were missing a '+' operator and a semicolon*)
  if I = 3 then
  Writeln('Fine')
end.

The solution is to make sure the necessary operators and semicolons are there.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...