Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: FORTRAN 77's GO TO <label> CONTINUE into Mata


From   "Joseph Coveney" <jcoveney@bigplanet.com>
To   "Statalist" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: FORTRAN 77's GO TO <label> CONTINUE into Mata
Date   Wed, 17 Oct 2007 11:09:22 -0700

Thank you, Thomas and Kit, for replying.

I'm not sure either why the initial code doesn't behave as anticipated.  The
lesson for me to learn is that the close brace in a -for- loop in Mata ought
not to be considered the same thing as the CONTINUE statement in FORTRAN.

Kit suggested:

Why not just do

for(j=1; j<=ncv; j++) {
   if(sm) {
sm = sm*b
       ...
      ...
}
}
Personal style, mostly.  Any pair of braces that I can avoid is one more
close brace that I don't have to worry about come debugging time.  I doubt
that the compiler cares between a loop jump and an -if- statement block, but
probably ought to do some timing just to make sure.

Joseph Coveney


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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