[R] labeled break statements in R?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 18 21:09:59 CEST 2004


On 18 Aug 2004, Roger Levy wrote:

> Are there labeled break statements in R?  i.e., something along the
> lines of
> 
> TOPLOOP: for(i in 1:m) {
>   for(j in 1:n) {
>     ...
>     if(condition) {
>        break TOPLOOP
>     }
>   }
> }

No, but if you find yourself using nested for loops it is very likely that 
you are not thinking in the right way for a vector language.

R does have a `R Language Definition' manual.  It's long been an
unfinished draft but it is not so incomplete as to omit reserved words.
It and the S reference books are the places to research questions like 
this.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list