Delphi Error – E2052 Unterminated string

Delphi Compiler Error

E2052 Unterminated string

Reason for the Error & Solution

The compiler did not find a closing apostrophe at the end of a character string.

Note that character strings cannot be continued onto the next line – however, you can use the ‘+’ operator to concatenate two character strings on separate lines.
For example, if we have two strings 'Embarcadero' and 'RAD Studio', they will become concatenated before runtime. This happens not only for strings, but integer, floating-point and set expressions not involving variables.
The reason why the evaluation happens at compile-time is the enabling the usage of constant expressions to be used in {$IF <expression>} {$IFEND} conditional compilation directives. This saves the expense of repeatedly evaluating an expression whose result is known not to change.

program Produce;

begin
  Writeln('Hello world!);   (*<-- Error message here -*)
end.

The closing quote is missing from the string – no big deal, happens all the time.

program Solve;

begin
  Writeln('Hello world!');
end.

So you supplied the closing quote, and the compiler is happy.

See Also

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...