for i
:= 0 to 100 do begin
if FirstToLast then begin
x := i;
end
else begin
x := 100 - i;
end;
// DO YOUR STUFF WITH X
end;
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Jeremy Coulter
Sent: Saturday, 20 March 2004 5:43 PM
To: [EMAIL PROTECTED]
Subject: [DUG] Multiple "FOR" loopsHi All.I want to be able to specify the direction of a FOR loop.i.e. if the type is FirstToLast then it will be for x:=0 to 100i.e. if the type is LastToFirst then it will be for x:=100 downto 0Basically I want to be able to go :-CASE Direction of0: for x:=0 to 1001: for x:=100 to 0END;Begin//for loop stuff hereEnd;But of course this is not valid.I then thought I should use a WHILE LOOP but the problem here is that even if I define the start and stop positions, it doesnt really herlp, i.e.While iStartPos <= iStopPos doIF iStop=100 and iStart=1 its fine, BUT if iStop is 1 and iStart=100 then it will not work.Anyone got any bright ideas? I REALLY dont want to make 2 "FOR" loops.Cheers,Jeremy Coulter------------------------------------------------------------------------All email scanned with Nortons Antivirus 2003------------------------------------------------------------------------
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
