Re: for loop (c-lang)



On Wed, 28 Feb 2007 12:43:12 +0000, Dodgy
<Dodgy@xxxxxxxxxxxxxxxxxxxxx> wrote:

<snip>

Well it might be in Delphi, not sure, can honestly say if I've ever
tried to do a loop zero times in a for, but from the programming
background I come from "for" and "repeat" loops have the comparison at
the end, a "while" has it at the beginning.

I guess I'll have to blow the dust of my asm programming and see what
Delphi pumps out.

Steve, I hope your ants are still marching :-}

For N := 2 To 1 Do

will not execute the loop, although in early versions of BASIC I have
heard that it did. I can't remember.

The real thing is that 'C' has its own rules and being supremely
illegible the OP that managed to post in a totally inappropriate group
failed to see that the expression in Delphi evaluates to :

For N := 0 To 0 Do

And it is pretty obvious that it will do its thing once.


.