[R] labeled break statements in R?
Roger Levy
rog at stanford.edu
Thu Aug 19 04:11:25 CEST 2004
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> 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.
Many thanks for the fast response -- I actually had looked in the R
language manual, and nothing was said about labeled breaks one way or
the other. The section on looping was terse enough that I thought it
might have been omitted.
Roger
More information about the R-help
mailing list