Expand To Show Full Article
Delphi Error - E2066 Missing operator or semicolon - Developer Publish

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.