On Wed, Jul 1, 2009 at 3:30 PM, Don MacQueen<m...@llnl.gov> wrote:
> My version would be
>
>  newDev <-  function() { dev.new(); invisible( dev.cur() ) }
>
> I agree with Hadley that return() is redundant in this instance. Using
> invisible() suppresses automatic printing of the returned value when it is
> not being assigned to a variable, thus making it more like dev.new().

 Hmmm. I really like using explicit return calls in my functions. It
seems, to me, to make it clear that I intend to return a value and
that value is going to be useful. How can others tell (without looking
at the ample documentation, of course) that you intend your function
to have a meaningful return value and it's not just "falling through"?

As The Zen of Python puts it:

 Explicit is better than implicit.
 Readability counts.

but you know, hey, whatever you want to do :)

Barry

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to