1

Why does b have a value? I think b should be null, because there is no return in function f.

f <- function(){
  a <- 10
}

b <- f()

b
# [1] 10
zx8754
  • 52,746
  • 12
  • 114
  • 209
김민재
  • 19
  • 1

1 Answers1

4

<- operator returns assignement invisibly, which allows

b <- a <- 1
b
a

> b
[1] 1
> a
[1] 1
Waldi
  • 39,242
  • 6
  • 30
  • 78