RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2013: Type of expression must be INTEGER (Delphi)

This error message is only given when the constant expression that specifies the number of characters in a string type is not of type integer.

program Produce;
type
  color = (red,green,blue);
var
  S3 : string[Succ(High(color))];
begin
end.

The example tries to specify the number of elements in a string as dependent on the maximum element of type color - unfortunately, the element count is of type color, which is illegal.

program Solve;
type
  color = (red,green,blue);
var
  S3 : string[ord(High(color))+1];
begin
end.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!