Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: increment operator


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   st: increment operator
Date   Thu, 07 Jan 2010 22:31:29 -0500


Is the behaviour of the following to be expected?


 local C = 0
 forv i=1/10 {
	di "`C'"
	local C++
 }

I know the increment operator is ++C, but inadvertently used this
instead and could not track down the error for quite a while, because
it even produced integer values in places. Seems like a bug.
Especially as trailing ++ is allowed in expansion operators:

 local C=0
 forv i=1/10 {
	di "`C++'"
 }

works just fine.

Jeph













*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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