Reputation: 2470
In R, I can do:
{1+1; 2+2; 3+3}
or, if you prefer:
{1+1
2+2
3+3}
Perhaps not surprisingly, both of these (compound) expressions evaluate to 6.
Is this a (documented) feature of the R language, that the value of a compound expression is equal to the last evaluated statement in the compound expression?
The official documentation is light on the topic: http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Compound-expressions
Upvotes: 0
Views: 514
Reputation: 2470
I see that this is in fact the documented behavior: http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Evaluation-of-expression-objects
Upvotes: 1