Article View: borland.public.delphi.language.objectpascal
Article #32549Re: Using constants & in
From: Brendan Bosman
Date: Fri, 22 Nov 2002 13:13
Date: Fri, 22 Nov 2002 13:13
83 lines
2089 bytes
2089 bytes
I got your answer
a set decl only takes 8 bit values.
Thus
const
a = 10
b = 1000
var
c: integer;
if c in [a..b] then
ebgin
end;
whill be interpreted as
if c in [a and 8 .. b and 8]
whic will go down to
if c in [10.. 232] then
begin
end;
I think you should use
case ... of
end
rather
regards
Brendan Bosman
"Stephen Froude" <sfroude@teleplan-uk.c0m> wrote in message
news:3dde25a1$1@newsgroups.borland.com...
>
> This is strange. If I run the following code, the for loop breaks on 233.
Why does this happen??? I'm using Delphi 6 Ent
>
> procedure TForm1.Button1Click(Sender: TObject);
> const
> STATUS_NEW: Integer = 100;
> STATUS_CANCELLED: Integer = 1000;
> var
> iLoop, iStatus: Integer;
> begin
> for iLoop:= STATUS_NEW to STATUS_CANCELLED do
> begin
> iStatus := iLoop;
> if not (iStatus in [STATUS_NEW..STATUS_CANCELLED]) then
> begin
> ShowMessage('Failed on ' + IntToStr(iStatus));
> Break;
> end;
> end;
> end;
Technical Details
Message-ID:
<3dde2dc9@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!newsfeed.online.be!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mailReferences:
<3dde1a3b$1@newsgroups.borland.com> <3dde1f33@newsgroups.borland.com> <3dde25a1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d30,1c6f6604b711dd81 X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2002-11-22 05:17:23 PST From: "Brendan Bosman" <brendan.bosman@syssol.ie> Newsgroups: borland.public.delphi.language.objectpascal References: <3dde1a3b$1@newsgroups.borland.com> <3dde1f33@newsgroups.borland.com> <3dde25a1$1@newsgroups.borland.com> Subject: Re: Using constants & in Date: Fri, 22 Nov 2002 13:13:00 -0000 Lines: 85 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 213.105.178.230 Message-ID: <3dde2dc9@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1037970889 213.105.178.230 (22 Nov 2002 05:14:49 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!newsfeed.online.be!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail