Show: Object Pascal C++
Display Preferences

E2013 Type of expression must be INTEGER (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

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.
Personal tools
In other languages