E2011 Low bound exceeds high bound (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

This error message is given when either the low bound of a subrange type is greater than the high bound, or the low bound of a case label range is greater than the high bound.


program Produce;
type
  SubrangeType = 1..0;              (*Gets: Low bound exceeds high bound *)
begin
  case True of
  True..False:                      (*Gets: Low bound exceeds high bound *)
    Writeln('Expected result');
  else
    Writeln('Unexpected result');
  end;
end.

In the example above, the compiler gives an error rather than treating the ranges as empty. Most likely, the reversal of the bounds was not intentional.


program Solve;
type
  SubrangeType = 0..1;
begin
  case True of
  False..True:
    Writeln('Expected result');
  else
    Writeln('Unexpected result');
  end;
end.

Make sure you have specified the bounds in the correct order.