[Lazarus] errors: Upper bound of case range is less than lower bound and duplicate case label

Alexander Klenin klenin at gmail.com
Mon Jan 21 04:54:35 CET 2013


On Mon, Jan 21, 2013 at 4:43 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
>>     case gradeSelected of
>>          '12'..'12': tuitionFee := '14500.00';
>
>
>            ^       ^   This should be easy to spot...

No, the error is in the line below.

>>          '8'..'11' : tuitionFee := '13500.00';

Note that strings are not numbers, so '8' > '11'.
Also, '1' < '11' < '7' < '8', so case branch labels intersect, which
is the reason for the second error.

On Mon, Jan 21, 2013 at 8:26 AM, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
> Maybe changing the message to "lower or equal" would help?

No, equal values are acceptable, although useless.

Eric: "case of string" is not suitable for your task, use the usual
"case of integer" instead.




More information about the Lazarus mailing list