Re: for loop (c-lang)
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 10:14:31 -0600
J French wrote:
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.
The expression in Delphi is equivalent to this:
while False do
Write('Why');
Your code is equivalent to this:
for (int N = 0; N <= 0; ++N)
The condition in the middle is evaluated *before* executing the body of the loop. Immediately before the loop terminates, the condition is also evaluated once more, but since it evaluates to False, the body is not executed afterward.
--
Rob
.
- References:
- for loop (c-lang)
- From: mohdalibaig
- Re: for loop (c-lang)
- From: Dodgy
- Re: for loop (c-lang)
- From: Maarten Wiltink
- Re: for loop (c-lang)
- From: Dodgy
- Re: for loop (c-lang)
- From: J French
- for loop (c-lang)
- Prev by Date: Re: SetString
- Next by Date: Re: for loop (c-lang)
- Previous by thread: Re: for loop (c-lang)
- Next by thread: Re: for loop (c-lang)
- Index(es):