Statalist


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

st: AW: increment operator


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: increment operator
Date   Fri, 8 Jan 2010 09:08:12 +0100

<> 


" Seems like a bug."



But note [U], p. 209:

" Finally,

local i++

will not increment the local macro i but instead redefines the local macro i
to contain ++."




HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Jeph Herrin
Gesendet: Freitag, 8. Januar 2010 04:31
An: [email protected]
Betreff: st: increment operator


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/


*
*   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