Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: A Mata question (2).

From   "Nick Cox" <>
To   <>
Subject   st: RE: A Mata question (2).
Date   Mon, 28 Nov 2005 18:09:22 -0000

I believe that there is no difference
in this case. It is a common convention
to write i++, not ++i, but that's 
just that, a common convention. 

On the principle that 

for(exp1; exp2; exp3) { 

is equivalent to

        while (exp2) {

the results of a -for- loop will not vary 
as long as different exp3 have the same results. 

In your case this is true of i++ and ++i
but I guess someone could come up with exp3 
for which this was no longer true. 

> for (i=1;i<=2;i++)
> Is there a difference with :
> for (i=1;i<=2;++i)
> It is not clear with (about the
> preseance of incrementing : before or after)?

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index