> I just came across a curious problem.
> I have the following code :- iColPos in [iLeft..iRight]
> if I put a breakpoint on this line, iRight is the same value as iLeft !!
> 
> what its meant to do is see if the value of iColPos is between the value of iLeft 
>and iRight.
> I cant use >= <= as it doesnt give me teh result I want.
> I guess what I am looking for is a BETWEEN function so I can go iColPos 
>Between(iLeftPos,iRightPos)
> 
> BUT teh problem above is somewhat curious....anyone know why or what would cause 
>this ??

Hmm the construct 'enumValue in [enumValue..enumValue]' 

seems to work here fine...

program Project1;

uses Dialogs;

type
  TMyEnum = (meOne,meTwo,meThree,meFour,meFive);
const
  BoolText :array[Boolean] of String = ('No','Yes');
var
  I :TMyEnum;
begin
  for I := low(I) to High(I) do
    ShowMessage(BoolText[I in [meTwo..meFour]]);
end.

Produces No,Yes,Yes,Yes,No

But the Debugger show bogus values for the range.  Not so much
incorrect as misleading (it only evaluates the range start).

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to