[R] crazy loop error.

Petr Savicky savicky at praha1.ff.cuni.cz
Tue Jan 25 09:46:02 CET 2011

On Tue, Jan 25, 2011 at 09:05:03AM +0100, Petr Savicky wrote:
> to foreach loop in Perl. If v is a vector, then
>   for (n in v)
> first creates the vector v and then always performs length(v) iterations.

I forgot that ‘break’ may stop the loop. See ?"for" for further
information. In particular, it says

  You can assign to ‘var’ within the body of the loop, but
  this will not affect the next iteration.

Petr Savicky.

More information about the R-help mailing list