How can I return a value in a function, through another function, see example here :
first_try <- function() eval(return(1),parent.frame())
second_try <- function() source(textConnection("return(2)"),parent.frame())
fun1 <- function(x){
first_try()
second_try()
3
}
fun1()
# [1] 3
fun1
should stop at first_try
and return 1
, and if second_try
had worked it would have returned 2
.
Is such a thing possible ?