RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2014: Statement expected, but expression of type '%s' found (Delphi)

The compiler was expecting to find a statement, but instead it found an expression of the specified type.

  program Produce;
    var
      a : Integer;
  begin
     (3 + 4);
  end.

In this example, the compiler is expecting to find a statement, such as an IF, WHILE, REPEAT, but instead it found the expression (3+4).

  program Produce;
    var
      a : Integer;
  begin
     a := (3 + 4);
  end.

The solution here was to assign the result of the expression (3+4) to the variable 'a'. Another solution would have been to remove the offending expression from the source code - the choice depends on the situation.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!