Re: Funny loop with post-increment.

Jon Skeet <[email protected]> Tue, 19 Feb 2008 08:37:51 +0000
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
Brady Kelly wrote:
>> Don't forget that this is a POST-increment. The return value of i++ is
>> the
>> original value of i, before it was incremented.
>
> I think we all know how post-increment works.  The question was why was i
> _still_ zero on the second loop iteration, after it should have been
> post-incremented.

If you knew how post-increment worked, why would there be a question?

The important thing to know is that the post-increment happens before
post expression evaluation, rather than post statement execution. To me,
that's part of knowing how post-increment works.

Jon

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com