E2052 Unterminated string (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

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