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"

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to