I have the following R code:
n <- 100
simul <- function() {
x <- sample(c(-1, 1), n, replace = TRUE)
s <- cumsum(c(0, x))
}
(tmp = simul())
In the above code, simul()
returns a vector to tmp
. How is this possible, since the function simul()
does not define any return value (at least, explicitly)?