That sort of surprises me - surely counting down instead of up would spoil
the expected logic of a loop in some cases
Eg a trivial example, getting the first word from a string...
Function getfirstword(aline:string):integer;
Var
i:integer;
For i:=1 to length(aline) do
Begin
if(aline[i]='
.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Bird
Sent: Tuesday, 7 August 2007 19:16
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] for..loop
That sort of surprises me - surely counting down instead of up would spoil
the expected
John
This is where 'optimisation' comes in it would count down because
'jump zero' is a single instruction but
would only apply this if there was no reference to the loop var ie
var
i: integer
for i:= 0 to 3 do
begin
write('hello')
end;
but don't do
for i:= 0 to 3 do
begin
end;
]; NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] for..loop
John
This is where 'optimisation' comes in it would count down because
'jump zero' is a single instruction but
would only apply this if there was no reference to the loop var ie
var
i: integer
for i:= 0 to 3 do
begin
Break?
Steve
--
Steve Peacocke
http://stevepeacocke.blogspot.com/
On 07/08/07, Ross Levis [EMAIL PROTECTED] wrote:
Why does the Delphi help say that a For loop variable has an undefined value
after the loop finishes it's iterations? Surely the variable is always 1
greater than the maximum
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Peacocke
Sent: Tuesday, 7 August 2007 15:32
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] for..loop
Break?
Steve
--
Steve Peacocke
http://stevepeacocke.blogspot.com/
On 07/08/07, Ross Levis [EMAIL PROTECTED] wrote
you.
-Original Message-
From: [EMAIL PROTECTED] [mailto:delphi-
[EMAIL PROTECTED] On Behalf Of Ross Levis
Sent: Tuesday, 7 August 2007 3:22 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] for..loop
Why does the Delphi help say that a For loop variable has
Hi
Like others have said, it could change at any time. If I need to nkow
if something was found there is usually another variable asside from
the counter that can be checked.
I almost always use while loops when searching for items as you can
easily exit them without using 'Break' (which I
Hi
Like others have said, it could change at any time. If I need to know
if something was found there is usually another variable asside from
the counter that can be checked.
I almost always use while loops when searching for items as you can
easily exit them without using 'Break' (which I
Maybe.
But I would suggest that if the doco says it's undefined, then you'd be
far safer writing the extra bit of code required to give you complete
safety.
C.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Ross Levis
I use Break if something is
-Original Message-
From: [EMAIL PROTECTED] [mailto:delphi-
[EMAIL PROTECTED]
On Behalf Of Ross Levis
I use Break if something is found, otherwise let it run to the end.
It's very convenient to test i maxvalue at the end to know if a break
occurred or not.
So as long as I don't
No.
Use a repeat or while loop.
-Original Message-From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jeremy
CoulterSent: Saturday, 4 August 2001 15:22To: Multiple
recipients of list delphiSubject: [DUG]: For
loop
Hi all. Is there
away in Delphi to do
You could do something like:
for i := 0 to 100 do if i mod 2 = 0 then
begin
// blah
end
--On Saturday, August 04, 2001 20:54:21 +1200 Patrick Dunford
[EMAIL PROTECTED] wrote:
No. Use a repeat or while loop.
--
Vi de udødelige inviterer dere til å slå dere sammen med oss
this might be more practical I think. Can only try.
Jeremy
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Mark Derricutt
Sent: Sunday, 5 August 2001 16:46
To: Multiple recipients of list delphi
Subject: RE: [DUG]: For loop
You could do something like
We have a winner :)
-- Forwarded Message --
Date: Sunday, August 05, 2001 16:43:20 +1200
From: Murray Speight [EMAIL PROTECTED]
To: Mark Derricutt [EMAIL PROTECTED]
Subject: Out of Office AutoReply: [DUG]: For loop
I am out of the Office until Monday 13 Aug 2001. Please feel
Hi all. Is there
away in Delphi to do a for loop with STEP in it ?
I..e in VB you can
go
for x=1 to 10 step 2
I wonder if there is
a way in delphi too?
I have had a look in
the help, but did not see anything obvious.
Cheers, Jeremy
Coulter
16 matches
Mail list logo