2

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)?

halfer
  • 19,471
  • 17
  • 87
  • 173
The Pointer
  • 1,954
  • 6
  • 15
  • 40

0 Answers0