Statalist


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

st: single line Mata do-while cycle


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   st: single line Mata do-while cycle
Date   Tue, 22 Sep 2009 12:32:07 -0500

I was expecting this snippet of code to work:

mata:
k=0
do k=k+1 while (k<10)

but...

: k=0

: do k=k+1 while (k<10)
'while' found where almost anything else expected
r(3000);

Breaking this into multiple lines does not help:

: do k=k+1
nothing found where 'while' expected
r(3000);

However, this one works:

do k=k+1; while (k<10)

Is that the case of "significant" semicolons per [M-2] semicolons? I
know that I sometimes need to use semicolons after -if- to indicate
absence of -else- statement in crooked branching code.

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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