哈哈!老兄就像 matlab global
GLOBAL Define global variable.
?"<<-"
############
x <- 5
add <- function(k) {
x <- x + k
10 + x }
x #5
add(1) #16
x #5
add(1) #16
##########define global variable
x <- 5
add <- function(k) {
x <<- x + k
10 + x }
x #6
add(1) #16
x #6
add(1) #17
Important! be aware of cautions about the use of global variables!!