From ggrothendieck at myway.com  Sun Dec 19 05:10:26 2004
From: ggrothendieck at myway.com (Gabor Grothendieck)
Date: Sun Dec 19 05:10:50 2004
Subject: [Rd] value of a loop broken by break
Message-ID: <loom.20041219T045943-386@post.gmane.org>


Should the 'for' loop in the following example not return 3 rather than 2?
The Language Manual says that it returns the result of the last evaluated
statement and that would be the i before the 'break'.  'repeat' and 'while'
have the same behavior.


R> (for(i in 1:10) if (i==3) { i; break } else i)
[1] 2

R> R.version.string # Windows XP
[1] "R version 2.0.1, 2004-11-04"


[Rd] value of a loop broken by break
Gabor Grothendieck