Delphi Error – E2011 Low bound exceeds high bound

Delphi Compiler Error

E2011 Low bound exceeds high bound

Reason for the Error & Solution

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.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...