Delphi Compiler Error
E2014 Statement expected, but expression of type ‘%s’ found
Reason for the Error & Solution
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.