[R] "return" function

About this list Date view Thread view Subject view Author view Attachment view

From: Chris Marshall (chris.marshall@wrx-us.com)
Date: Sat 15 Sep 2001 - 00:47:56 EST


Message-id: <D8FC432ED011D511B1D9001083FD45E70F35F7@norcom2.norcom.net>

I tried to write a function like this

f1 <- function(){
   if (condition 1) return
   if (condition 2) return
   ...
   if (condition 3) return

   do more work
}

Where I am using return to exit the function prematurely when I detect
conditions that warrant it. Return doesn't seem to work this way.

How should I do this?

Chris Marshall
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:10:06 EST