Entering edit mode
SHEN, WEICHENG .
▴
30
@shen-weicheng-296
Last seen 10.4 years ago
Hi all:
I need to conditionally exit from a function, but don't know how. My
example
below indicates that when x>0, I wish to immediately exit from the
function
foo. I also with to return a flag value so that I could find out what
happend in executing this function. What command I can use to make it
happen? Your help and suggestions will be greatly appreciated. Thanks!
======================================================================
======
===================================
foo<-function (x)
{
if (x>0) {
do something ....
} else {
# need to exit from this function at this point, and
also
return a flag value
}
do something ...
}
Weicheng Shen, Ph.D.
Senior Image Analyst
Science Applications International Corporation
1710 SAIC Drive
Mail Stop 2-6-9
McLean, VA 22102
(703) 676-4189